redis_keep_alive fix on usagecachemanager using keyv/redis (#5519)
This commit is contained in:
parent
20db1597a4
commit
069ba28bc0
|
|
@ -37,7 +37,19 @@ export class UsageCacheManager {
|
|||
if (process.env.MODE === MODE.QUEUE) {
|
||||
let redisConfig: string | Record<string, any>
|
||||
if (process.env.REDIS_URL) {
|
||||
redisConfig = process.env.REDIS_URL
|
||||
redisConfig = {
|
||||
url: process.env.REDIS_URL,
|
||||
socket: {
|
||||
keepAlive:
|
||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||
: undefined
|
||||
},
|
||||
pingInterval:
|
||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||
: undefined
|
||||
}
|
||||
} else {
|
||||
redisConfig = {
|
||||
username: process.env.REDIS_USERNAME || undefined,
|
||||
|
|
@ -48,8 +60,16 @@ export class UsageCacheManager {
|
|||
tls: process.env.REDIS_TLS === 'true',
|
||||
cert: process.env.REDIS_CERT ? Buffer.from(process.env.REDIS_CERT, 'base64') : undefined,
|
||||
key: process.env.REDIS_KEY ? Buffer.from(process.env.REDIS_KEY, 'base64') : undefined,
|
||||
ca: process.env.REDIS_CA ? Buffer.from(process.env.REDIS_CA, 'base64') : undefined
|
||||
}
|
||||
ca: process.env.REDIS_CA ? Buffer.from(process.env.REDIS_CA, 'base64') : undefined,
|
||||
keepAlive:
|
||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||
: undefined
|
||||
},
|
||||
pingInterval:
|
||||
process.env.REDIS_KEEP_ALIVE && !isNaN(parseInt(process.env.REDIS_KEEP_ALIVE, 10))
|
||||
? parseInt(process.env.REDIS_KEEP_ALIVE, 10)
|
||||
: undefined
|
||||
}
|
||||
}
|
||||
this.cache = createCache({
|
||||
|
|
|
|||
Loading…
Reference in New Issue