From f066446386b5b8feafc55ecefba1426f1e75bc5c Mon Sep 17 00:00:00 2001 From: Anant Jain Date: Thu, 14 Sep 2023 09:29:58 +0530 Subject: [PATCH 1/3] chore: update redis expiry time --- sample.env | 1 + src/util/redis/redisConnector.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sample.env b/sample.env index 02ef06c9c6..c418718185 100644 --- a/sample.env +++ b/sample.env @@ -9,3 +9,4 @@ REDIS_PORT = 6379 REDIS_PASSWORD = 123 REDIS_USERNAME = abc USE_REDIS_DB = true +redisDefaultExpiryTime = 86400 \ No newline at end of file diff --git a/src/util/redis/redisConnector.js b/src/util/redis/redisConnector.js index 5a61e683b6..e2c5f6d561 100644 --- a/src/util/redis/redisConnector.js +++ b/src/util/redis/redisConnector.js @@ -32,7 +32,7 @@ const RedisDB = { log.error(`Redis is down at ${this.host}:${this.port}`); return false; // stop retrying }, - tls: {} + tls: {}, }); this.client.on('ready', () => { log.info(`Connected to redis at ${this.host}:${this.port}`); @@ -102,7 +102,7 @@ const RedisDB = { * @param {*} isValJson set to false if value is not a json object * */ - async setVal(key, value, expiryTimeInSec = 60 * 60) { + async setVal(key, value, expiryTimeInSec = process.env.redisDefaultExpiryTime || 60 * 60) { try { await this.checkAndConnectConnection(); // check if redis is connected and if not, connect if (typeof value === 'object') { From a701b7f81fff1447ab8d83869900cea278081e26 Mon Sep 17 00:00:00 2001 From: Anant Jain Date: Thu, 14 Sep 2023 09:59:02 +0530 Subject: [PATCH 2/3] comment addressed --- sample.env | 2 +- src/util/redis/redisConnector.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample.env b/sample.env index c418718185..34429e1308 100644 --- a/sample.env +++ b/sample.env @@ -9,4 +9,4 @@ REDIS_PORT = 6379 REDIS_PASSWORD = 123 REDIS_USERNAME = abc USE_REDIS_DB = true -redisDefaultExpiryTime = 86400 \ No newline at end of file +REDIS_EXPIRY_TIME = 60*60 \ No newline at end of file diff --git a/src/util/redis/redisConnector.js b/src/util/redis/redisConnector.js index e2c5f6d561..d35c879cfe 100644 --- a/src/util/redis/redisConnector.js +++ b/src/util/redis/redisConnector.js @@ -102,7 +102,7 @@ const RedisDB = { * @param {*} isValJson set to false if value is not a json object * */ - async setVal(key, value, expiryTimeInSec = process.env.redisDefaultExpiryTime || 60 * 60) { + async setVal(key, value, expiryTimeInSec = process.env.REDIS_EXPIRY_TIME || 60 * 60) { try { await this.checkAndConnectConnection(); // check if redis is connected and if not, connect if (typeof value === 'object') { From b1f605c6c33e2e8539b8b78f0bc2cd7b587049d4 Mon Sep 17 00:00:00 2001 From: Anant Jain Date: Thu, 14 Sep 2023 22:23:14 +0530 Subject: [PATCH 3/3] comment addressed --- sample.env | 2 +- src/util/redis/redisConnector.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample.env b/sample.env index 34429e1308..71b11fbfca 100644 --- a/sample.env +++ b/sample.env @@ -9,4 +9,4 @@ REDIS_PORT = 6379 REDIS_PASSWORD = 123 REDIS_USERNAME = abc USE_REDIS_DB = true -REDIS_EXPIRY_TIME = 60*60 \ No newline at end of file +REDIS_EXPIRY_TIME_IN_SEC = 3600 \ No newline at end of file diff --git a/src/util/redis/redisConnector.js b/src/util/redis/redisConnector.js index d35c879cfe..749e23ff83 100644 --- a/src/util/redis/redisConnector.js +++ b/src/util/redis/redisConnector.js @@ -102,7 +102,7 @@ const RedisDB = { * @param {*} isValJson set to false if value is not a json object * */ - async setVal(key, value, expiryTimeInSec = process.env.REDIS_EXPIRY_TIME || 60 * 60) { + async setVal(key, value, expiryTimeInSec = process.env.REDIS_EXPIRY_TIME_IN_SEC || 3600) { try { await this.checkAndConnectConnection(); // check if redis is connected and if not, connect if (typeof value === 'object') {