Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/archiver/src/workers/spaceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ export function createSpaceManager(options: SpaceManagerOptions) {
}
})()

let timeoutTimer: ReturnType<typeof setTimeout> | undefined
const timeoutPromise = new Promise<never>((_, reject) => {
setTimeout(() => {
timeoutTimer = setTimeout(() => {
loopController.abort()
reject(
new SpaceManagerError(
Expand All @@ -151,6 +152,13 @@ export function createSpaceManager(options: SpaceManagerOptions) {
loopController.abort()
await removeFromQueue(token)
throw error
} finally {
// Clear the timer on the success path too. Without this every
// satisfied claim leaves a pending timer alive for the full
// maxDiskSpaceWaitSeconds — harmless in isolation, but this is a
// long-lived worker and the whole point of this change is to stop
// leaking per-job resources.
clearTimeout(timeoutTimer)
}
})()
}
Expand Down
Loading