added retryDelay option for AWS

This commit is contained in:
Eslam A. Hefnawy 2016-04-11 18:17:35 +07:00
parent f9bc100f74
commit 531bdc6db3

View File

@ -24,6 +24,10 @@ module.exports = function(S) {
this._config = config || {};
this.sdk = AWS; // We recommend you use the "request" method instead
// set retry delay to mitigate AWS API calls rate limits
//
AWS.config.update({retryDelayOptions: {base: 300}});
// Use HTTPS Proxy (Optional)
let proxy = process.env.proxy || process.env.HTTP_PROXY || process.env.http_proxy || process.env.HTTPS_PROXY || process.env.https_proxy;
if (proxy) {
@ -39,6 +43,12 @@ module.exports = function(S) {
AWS.config.httpOptions.timeout = parseInt(timeout, 10);
}
// Configure the AWS Retry Delay to mitigate AWS API calls rate limits
let retryDelay = process.env.AWS_RETRY_DELAY || process.env.aws_retry_delay;
if (retryDelay) {
AWS.config.update({retryDelayOptions: {base: retryDelay}});
}
// Detect Profile Prefix. Useful for multiple projects (e.g., myproject_prod)
this._config.profilePrefix = process.env['AWS_PROFILE_PREFIX'] ? process.env['AWS_PROFILE_PREFIX'] : null;
if (this._config.profilePrefix && this._config.profilePrefix.charAt(this._config.profilePrefix.length - 1) !== '_') {