Update locks error logging (#9768)

* Fix intermittent backend-core migration test failure

* Update lock logging
This commit is contained in:
Rory Powell 2023-02-22 08:32:03 +00:00 committed by GitHub
parent 1e0e3ce19e
commit 6a88cfc32d
1 changed files with 4 additions and 1 deletions

View File

@ -85,17 +85,20 @@ export const doWithLock = async (opts: LockOptions, task: any) => {
const result = await task()
return result
} catch (e: any) {
console.log("lock error")
console.warn("lock error")
// lock limit exceeded
if (e.name === "LockError") {
if (opts.type === LockType.TRY_ONCE) {
// don't throw for try-once locks, they will always error
// due to retry count (0) exceeded
console.warn(e)
return
} else {
console.error(e)
throw e
}
} else {
console.error(e)
throw e
}
} finally {