From 25099ee28ef8bb004d8bf5508fecb901c983dfb5 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 30 Nov 2023 12:02:47 +0100 Subject: [PATCH] Clean redlock test settings --- packages/backend-core/src/redis/redlockImpl.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/backend-core/src/redis/redlockImpl.ts b/packages/backend-core/src/redis/redlockImpl.ts index dec8aad032..a4586a4495 100644 --- a/packages/backend-core/src/redis/redlockImpl.ts +++ b/packages/backend-core/src/redis/redlockImpl.ts @@ -13,13 +13,7 @@ async function getClient( if (type === LockType.CUSTOM) { return newRedlock(opts) } - if ( - env.isTest() && - type !== LockType.TRY_ONCE && - type !== LockType.AUTO_EXTEND - ) { - return newRedlock(OPTIONS.TEST) - } + switch (type) { case LockType.TRY_ONCE: { return newRedlock(OPTIONS.TRY_ONCE) @@ -42,7 +36,7 @@ async function getClient( } } -const OPTIONS: Record = { +const OPTIONS: Record = { TRY_ONCE: { // immediately throws an error if the lock is already held retryCount: 0, @@ -50,11 +44,6 @@ const OPTIONS: Record = { TRY_TWICE: { retryCount: 1, }, - TEST: { - // higher retry count in unit tests - // due to high contention. - retryCount: 100, - }, DEFAULT: { // the expected clock drift; for more details // see http://redis.io/topics/distlock