From d202157c35b7084eaf0d6a78b573d2ac090e2edf Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 17 Aug 2024 21:21:16 +0530 Subject: [PATCH] fix: avoid setting ttl to 0 (#9284) Co-authored-by: mertmit --- .../global-exception/global-exception.filter.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts index 05c0fb46d0..cc63406adf 100644 --- a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts +++ b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts @@ -107,9 +107,13 @@ export class GlobalExceptionFilter implements ExceptionFilter { (data.timestamp + 300000 - Date.now()) / 1000, ); - NocoCache.setExpiring(cacheKey, data, ttlInSeconds).catch((err) => { - this.logger.error(err); - }); + if (ttlInSeconds <= 0) { + NocoCache.setExpiring(cacheKey, data, ttlInSeconds).catch( + (err) => { + this.logger.error(err); + }, + ); + } // log every 50th request in last 5 minutes after first if (data.count % 50 === 0) {