Skip to content

Commit

Permalink
add RequestHandler to AWSConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
nuhasha committed Jan 18, 2024
1 parent fda92bf commit 3958781
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 5 additions & 4 deletions collectors/aws/collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@
const {
EC2
} = require('@aws-sdk/client-ec2');
const {
DynamoDBClient
} = require('@aws-sdk/client-dynamodb');

var async = require('async');
//var https = require('https');
var helpers = require(__dirname + '/../../helpers/aws');
var collectors = require(__dirname + '/../../collectors/aws');
var collectData = require(__dirname + '/../../helpers/shared.js');
Expand Down Expand Up @@ -62,6 +58,11 @@ var collect = function(AWSConfig, settings, callback) {
var debugMode = settings.debug_mode;
if (debugMode) AWSXRay = require('aws-xray-sdk');

const customRequestHandler = new NodeHttpHandler({
httpsAgent: new Agent({maxSockets: 100}),
httpAgent: new HttpAgent({maxSockets: 100})
});
AWSConfig.requestHandler = customRequestHandler;
AWSConfig.maxRetries = 8;
AWSConfig.retryDelayOptions = {base: 100};

Expand Down
11 changes: 5 additions & 6 deletions collectors/aws/collector_multipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@
const {
EC2
} = require('@aws-sdk/client-ec2');
const {
DynamoDBClient
} = require('@aws-sdk/client-dynamodb');

var async = require('async');
var helpers = require(__dirname + '/../../helpers/aws');
var collectors = require(__dirname + '/../../collectors/aws');
var collectData = require(__dirname + '/../../helpers/shared.js');

// Override max sockets
// JS SDK v3 does not support global configuration.
// Codemod has attempted to pass values to each service client in this file.
// You may need to update clients outside of this file, if they use global config.
const { Agent } = require('https');
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler');

Expand Down Expand Up @@ -71,6 +65,11 @@ var collect = function(AWSConfig, settings, callback) {
var debugMode = settings.debug_mode;
if (debugMode) AWSXRay = require('aws-xray-sdk');

const customRequestHandler = new NodeHttpHandler({
httpsAgent: new Agent({maxSockets: 100}),
httpAgent: new HttpAgent({maxSockets: 100})
});
AWSConfig.requestHandler = customRequestHandler;
AWSConfig.maxRetries = 8;
AWSConfig.retryDelayOptions = {base: 100};

Expand Down

0 comments on commit 3958781

Please sign in to comment.