From 165363f1bb4ac654a2dd4a7388f624eabce5d782 Mon Sep 17 00:00:00 2001 From: Oliver Fawcett Date: Fri, 27 Sep 2024 12:41:59 +1200 Subject: [PATCH] RateLimiterDynamo: Add key to skip creating ttl --- lib/RateLimiterDynamo.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/RateLimiterDynamo.js b/lib/RateLimiterDynamo.js index dca5cf8..e2f574d 100644 --- a/lib/RateLimiterDynamo.js +++ b/lib/RateLimiterDynamo.js @@ -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) @@ -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});