This commit is contained in:
Adria Navarro 2024-03-07 11:23:09 +01:00
parent 17b06703e9
commit 536422e60b
1 changed files with 1 additions and 9 deletions

View File

@ -82,11 +82,6 @@ type SuccessfulRedlockExecution<T> = {
} }
type UnsuccessfulRedlockExecution = { type UnsuccessfulRedlockExecution = {
executed: false executed: false
reason: UnsuccessfulRedlockExecutionReason
}
export const enum UnsuccessfulRedlockExecutionReason {
LockTakenWithTryOnce = "LOCK_TAKEN_WITH_TRY_ONCE",
} }
type RedlockExecution<T> = type RedlockExecution<T> =
@ -146,10 +141,7 @@ export async function doWithLock<T>(
if (opts.type === LockType.TRY_ONCE) { if (opts.type === LockType.TRY_ONCE) {
// don't throw for try-once locks, they will always error // don't throw for try-once locks, they will always error
// due to retry count (0) exceeded // due to retry count (0) exceeded
return { return { executed: false }
executed: false,
reason: UnsuccessfulRedlockExecutionReason.LockTakenWithTryOnce,
}
} else { } else {
throw e throw e
} }