makes the next listener one-time use, to avoid memory leaks.

Signed-off-by: Hao Luo <howlowck@gmail.com>
This commit is contained in:
Hao Luo
2022-12-05 14:51:16 -06:00
parent 5f3f0f0002
commit cbbdf25ddb
@@ -124,7 +124,7 @@ export class TaskWorker {
return new Promise(resolve => {
// "next" event emits when a task completes
// https://github.com/sindresorhus/p-queue#next
this.taskQueue.on('next', () => {
this.taskQueue.once('next', () => {
resolve();
});
});