Skip to content

Commit

Permalink
Merge pull request #25 from DanteInc/issue-allow-max-sockets-configur…
Browse files Browse the repository at this point in the history
…ation

Allow max sockets configuration in sdk client.
  • Loading branch information
petermyers authored Jun 4, 2024
2 parents 054be12 + 6669f40 commit bb920f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-kms-ee",
"version": "1.0.3",
"version": "1.0.4",
"description": "AWS KMS Envelope Encryption",
"main": "./lib/index.js",
"files": [
Expand Down
5 changes: 5 additions & 0 deletions src/connector.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
import Promise from 'bluebird';
import memoryCache from 'memory-cache';
import { Agent } from 'https';
import { DecryptCommand, EncryptCommand, GenerateDataKeyCommand, KMSClient } from '@aws-sdk/client-kms';
import { NodeHttpHandler } from '@smithy/node-http-handler';
import { getClientLogger } from './utils';
Expand All @@ -14,13 +15,17 @@ class Connector {
timeout = Number(process.env.KMS_TIMEOUT || process.env.TIMEOUT || 1000),
connectTimeout = Number(process.env.KMS_CONNECT_TIMEOUT || process.env.CONNECT_TIMEOUT || 1000),
maxAge = Number(process.env.DATA_KEY_MAX_AGE) || undefined, // default to life of lambda function
maxSockets = Number(process.env.MAX_SOCKETS) || 50,
) {
this.maxAge = maxAge;
this.masterKeyAlias = masterKeyAlias;
this.kms = new KMSClient({
requestHandler: new NodeHttpHandler({
requestTimeout: timeout,
connectionTimeout: connectTimeout,
httpsAgent: new Agent({
maxSockets,
}),
}),
logger: getClientLogger(),
region,
Expand Down

0 comments on commit bb920f2

Please sign in to comment.