Skip to content

Commit

Permalink
Merge pull request #278 from ollyfg/ollyfg/skip-dynamo-ttl-check
Browse files Browse the repository at this point in the history
RateLimiterDynamo: Add key to skip querying ttl
  • Loading branch information
animir authored Oct 20, 2024
2 parents 661d794 + 165363f commit dfb296f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/RateLimiterDynamo.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class RateLimiterDynamo extends RateLimiterStoreAbstract {
this.client = opts.storeClient;
this.tableName = opts.tableName;
this.tableCreated = opts.tableCreated;
this.ttlManuallySet = opts.ttlSet;

if (!this.tableCreated) {
this._createTable(opts.dynamoTableOpts)
Expand Down Expand Up @@ -349,6 +350,10 @@ class RateLimiterDynamo extends RateLimiterStoreAbstract {
throw new Error('Table is not created yet');
}

if (this.ttlManuallySet) {
return true;
}

try {

const res = await this.client.describeTimeToLive({TableName: this.tableName});
Expand Down

0 comments on commit dfb296f

Please sign in to comment.