Skip to content

Commit

Permalink
add maxSockets to http agent
Browse files Browse the repository at this point in the history
  • Loading branch information
frankleng committed Aug 21, 2023
1 parent 0d6a59d commit faf3198
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 42 deletions.
76 changes: 38 additions & 38 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": "dynadash",
"version": "1.9.4",
"version": "1.9.5",
"description": "DynamoDb helpers",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",
Expand Down
8 changes: 5 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { NodeHttpHandler } from "@aws-sdk/node-http-handler";

import https from "https";
const agent = new https.Agent({
maxSockets: 25,
});
export let ddbClientInstance: DynamoDBClient | null = null;

export function getDdbClient(): DynamoDBClient {
if (!ddbClientInstance) {
ddbClientInstance = new DynamoDBClient({
maxAttempts: 5,
requestHandler: new NodeHttpHandler({
socketTimeout: 10000,
connectionTimeout: 10000,
httpsAgent: agent,
}),
});
}
Expand Down

0 comments on commit faf3198

Please sign in to comment.