diff --git a/packages/backend-core/src/redis/redlockImpl.ts b/packages/backend-core/src/redis/redlockImpl.ts index 9a6b200c81..d57385d8fe 100644 --- a/packages/backend-core/src/redis/redlockImpl.ts +++ b/packages/backend-core/src/redis/redlockImpl.ts @@ -5,6 +5,7 @@ import * as context from "../context" import env from "../environment" import { logWarn } from "../logging" import { Duration } from "../utils" +import { timers } from ".." async function getClient( type: LockType, @@ -118,7 +119,7 @@ export async function doWithLock( if (!opts.ttl) { // No TTL is provided, so we keep extending the lock while the task is running - interval = setInterval(async () => { + interval = timers.set(async () => { await lock?.extend(ttl / 2) }, ttl / 2) } @@ -146,7 +147,7 @@ export async function doWithLock( await lock.unlock() } if (interval) { - clearInterval(interval) + timers.clear(interval) } } }