more queue fixes

This commit is contained in:
Dave Horton
2022-02-24 14:24:52 -05:00
parent 64b31120a5
commit 5b11b6e401

View File

@@ -318,6 +318,7 @@ class CallSession extends Emitter {
if (0 === this.tasks.length && this.hasStableDialog && this.requestor instanceof WsRequestor) { if (0 === this.tasks.length && this.hasStableDialog && this.requestor instanceof WsRequestor) {
try { try {
await this._awaitCommandsOrHangup(); await this._awaitCommandsOrHangup();
if (!this.hasStableDialog || this.callGone) break;
} catch (err) { } catch (err) {
this.logger.info(err, 'CallSession:exec - error waiting for new commands'); this.logger.info(err, 'CallSession:exec - error waiting for new commands');
break; break;
@@ -681,6 +682,7 @@ class CallSession extends Emitter {
this.logger.info(`CallSession:_onCommand - invalid command ${command}`); this.logger.info(`CallSession:_onCommand - invalid command ${command}`);
} }
if (this.wakeupResolver) { if (this.wakeupResolver) {
this.logger.info('CallSession:_onCommand - got commands, waking up..');
this.wakeupResolver(); this.wakeupResolver();
this.wakeupResolver = null; this.wakeupResolver = null;
} }
@@ -1103,6 +1105,7 @@ class CallSession extends Emitter {
_awaitCommandsOrHangup() { _awaitCommandsOrHangup() {
assert(!this.wakeupResolver); assert(!this.wakeupResolver);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.logger.info('_awaitCommandsOrHangup - waiting...');
this.wakeupResolver = resolve; this.wakeupResolver = resolve;
}); });
} }