Skip to content

Commit 2ebc06e

Browse files
committed
fix(worker): interrupt completion delay on stop
1 parent 0cc98f2 commit 2ebc06e

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/worker_session.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export class WorkerSession {
192192
this.#stopping = true
193193
this.#running = false
194194
this.#delayController?.abort()
195+
this.#completionDelayController?.abort()
195196

196197
if (this.#fillOperation) {
197198
debug('worker %s: waiting for in-flight job acquisitions to complete', this.#workerId)

tests/worker_session.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ test.group('WorkerSession', () => {
256256
await setTimeout(0)
257257

258258
const stop = trackPromise(session.stop())
259+
await setTimeout(0)
260+
261+
assert.isTrue(pendingCycle.settled)
259262
assert.isFalse(stop.settled)
260263

261264
execution.resolve()

0 commit comments

Comments
 (0)