diff --git a/lib/tasks/enqueue.js b/lib/tasks/enqueue.js index 8174593e..5a6b4162 100644 --- a/lib/tasks/enqueue.js +++ b/lib/tasks/enqueue.js @@ -114,6 +114,7 @@ class TaskEnqueue extends Task { this.bridgeDetails = opts; this.logger.info({bridgeDetails: this.bridgeDetails}, `time to dequeue from ${this.queueName}`); if (this._playSession) { + this._leave = false; this._playSession.kill(); this._playSession = null; } @@ -325,10 +326,9 @@ class TaskEnqueue extends Task { // check for 'leave' verb and only execute tasks up till then const tasksToRun = []; - let leave = false; for (const o of tasks) { if (o.name === TaskName.Leave) { - leave = true; + this._leave = true; this.logger.info('waitHook returned a leave task'); break; } @@ -348,7 +348,7 @@ class TaskEnqueue extends Task { await this._playSession.exec(); this._playSession = null; } - if (leave) { + if (this._leave) { this.state = QueueResults.Leave; this.kill(cs); }