Skip to content

Commit

Permalink
feat: reuse connections in dynamodb http client
Browse files Browse the repository at this point in the history
  • Loading branch information
smrz2001 committed Jun 11, 2024
1 parent 5376fc8 commit 406ebc6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/services/witness-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Config } from 'node-config-ts'
import { DynamoDB } from '@aws-sdk/client-dynamodb'
import { logger } from '../logger/index.js'
import { Utils } from '../utils.js'
import * as http from 'http'
import { NodeHttpHandler } from '@smithy/node-http-handler'

const carFactory = new CARFactory()

Expand Down Expand Up @@ -160,6 +162,11 @@ export class DynamoDbWitnessService extends WitnessService implements IWitnessSe
this.dynamoDb = new DynamoDB({
region: config.witnessStorage.awsRegion,
endpoint: config.witnessStorage.dynamoDbEndpoint,
requestHandler: new NodeHttpHandler({
httpAgent: new http.Agent({
keepAlive: true,
}),
}),
})
this.tableName = config.witnessStorage.dynamoDbTableName || DEFAULT_WITNESS_TABLE_NAME
this.ttl = config.witnessStorage.dynamoDbTtl || DEFAULT_WITNESS_TABLE_TTL
Expand Down

0 comments on commit 406ebc6

Please sign in to comment.