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 e3b1204472
commit 19c86fa738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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() const result = await task()
return result return result
} catch (e: any) { } catch (e: any) {
console.log("lock error") console.warn("lock error")
// lock limit exceeded // lock limit exceeded
if (e.name === "LockError") { if (e.name === "LockError") {
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
console.warn(e)
return return
} else { } else {
console.error(e)
throw e throw e
} }
} else { } else {
console.error(e)
throw e throw e
} }
} finally { } finally {