Skip to content

Commit 8b6e735

Browse files
committed
Prevent cancelled queues from processing beyond the point of cancellation.
1 parent e05efb0 commit 8b6e735

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ngnjs/queue",
3-
"version": "1.0.0-alpha.6",
3+
"version": "1.0.0-alpha.7",
44
"description": "A lightweight NGN queue (taskrunner).",
55
"type": "module",
66
"main": "src/index.js",

src/item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default class Item extends NGN.EventEmitter {
110110
// If the item is part of a queue handled by a runner,
111111
// respect the state of the runner.
112112
if (this.parent && this.parent.parent) {
113-
if (this.parent.parent.continue) {
113+
if (!this.parent.parent.continue) {
114114
return
115115
}
116116
}

src/runner.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class Queue extends EventEmitter {
4141
this.emit('status.change', { old, current: value })
4242
}
4343
}),
44-
continue: NGN.get(() => this.#status === 'aborting'),
44+
continue: NGN.get(() => this.#status !== 'aborting' && this.#status !== 'cancelled'),
4545
moduleVersion: NGN.hiddenconstant('<#REPLACE_VERSION#>')
4646
})
4747

@@ -94,6 +94,10 @@ export default class Queue extends EventEmitter {
9494
return this.#cancelled
9595
}
9696

97+
get status () {
98+
return this.#status
99+
}
100+
97101
reset () {
98102
this.#queue.afterOnce('reset', this.#queue.size, () => {
99103
this.#cancelled = false

0 commit comments

Comments
 (0)