bugfix: if enqeue task is killed because it is being replaced with new app supplied by LCC, ignore any app returned from the actionHook as LCC takes precedence

This commit is contained in:
Dave Horton
2021-06-23 11:14:19 -04:00
parent 14ab8a9639
commit 59cf0610dd

View File

@@ -65,7 +65,7 @@ class TaskEnqueue extends Task {
super.kill(cs); super.kill(cs);
this.killReason = reason || KillReason.Hangup; this.killReason = reason || KillReason.Hangup;
this.logger.info(`TaskEnqueue:kill ${this.queueName} with reason ${this.killReason}`); this.logger.info(`TaskEnqueue:kill ${this.queueName} with reason ${this.killReason}`);
this.emitter.emit('kill'); this.emitter.emit('kill', reason || KillReason.Hangup);
this.notifyTaskDone(); this.notifyTaskDone();
} }
@@ -239,7 +239,8 @@ class TaskEnqueue extends Task {
ep.unbridge().catch((err) => {}); ep.unbridge().catch((err) => {});
resolve(); resolve();
}) })
.on('kill', () => { .on('kill', (reason) => {
this.killReason = reason;
this.logger.info(`TaskEnqueue:_bridgeLocal ending with ${this.killReason}`); this.logger.info(`TaskEnqueue:_bridgeLocal ending with ${this.killReason}`);
ep.unbridge().catch((err) => {}); ep.unbridge().catch((err) => {});
@@ -277,7 +278,6 @@ class TaskEnqueue extends Task {
const {lengthOfList} = cs.srf.locals.dbHelpers; const {lengthOfList} = cs.srf.locals.dbHelpers;
const members = await lengthOfList(this.queueName); const members = await lengthOfList(this.queueName);
this.dequeued = true; this.dequeued = true;
cs.performQueueWebhook({ cs.performQueueWebhook({
event: 'leave', event: 'leave',
queue: this.data.name, queue: this.data.name,