From c5e4e2216b9ceca9b52fe87bfbd4579a92243b85 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Tue, 16 Jan 2024 23:02:46 +0800 Subject: [PATCH] Simplify connection options --- packages/api/src/redis_data_source.ts | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/api/src/redis_data_source.ts b/packages/api/src/redis_data_source.ts index 5ac4ce64a..54f596a36 100644 --- a/packages/api/src/redis_data_source.ts +++ b/packages/api/src/redis_data_source.ts @@ -56,26 +56,27 @@ const createIORedisClient = ( tls, connectTimeout: 10000, maxRetriesPerRequest: null, - reconnectOnError: (err: Error) => { - const targetErrors = [/READONLY/, /ETIMEDOUT/] + // reconnectOnError: (err: Error) => { + // const targetErrors = [/READONLY/, /ETIMEDOUT/] - targetErrors.forEach((targetError) => { - if (targetError.test(err.message)) { - // Only reconnect when the error contains the keyword - return true - } - }) + // targetErrors.forEach((targetError) => { + // if (targetError.test(err.message)) { + // // Only reconnect when the error contains the keyword + // return true + // } + // }) - return false - }, + // return false + // }, retryStrategy: (times: number) => { - if (times > 10) { - // End reconnecting after a specific number of tries and flush all commands with a individual error - return null - } + // if (times > 10) { + // // End reconnecting after a specific number of tries and flush all commands with a individual error + // return null + // } - // reconnect after - return Math.min(times * 50, 2000) + // // reconnect after + // return Math.min(times * 50, 2000) + return 10 }, } console.log('connecting to redis: ', { redisURL, redisOptions })