Skip to content

Commit 700f432

Browse files
committed
smarter restore locking
1 parent 122db79 commit 700f432

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/utils/db-dump-manager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ export class DBDumpManager {
158158
const now = new Date()
159159

160160
// Check if the lock has expired
161-
if (now.getTime() - lockTimestamp.getTime() > this.LOCK_TIMEOUT_MS) {
161+
if (
162+
now.getTime() - lockTimestamp.getTime() > this.LOCK_TIMEOUT_MS ||
163+
lockData.processorName === processorName // A past runtime opened this lock.
164+
) {
162165
console.log(`Removing expired restore lock for processor: ${lockData.processorName}`)
163166
await client.query('DELETE FROM "util_cache" WHERE id = $1', [this.LOCK_KEY])
164167
} else {

0 commit comments

Comments
 (0)