fix assertion

This commit is contained in:
Dave Horton
2022-03-31 13:07:58 -04:00
parent d135247500
commit 43564502f7
2 changed files with 6 additions and 1 deletions

View File

@@ -236,6 +236,7 @@ class CallSession extends Emitter {
async enableBotMode(gather, autoEnable) { async enableBotMode(gather, autoEnable) {
try { try {
gather.timeout = 0; // background gathers should not timeout
const t = normalizeJambones(this.logger, [gather]); const t = normalizeJambones(this.logger, [gather]);
this.backgroundGatherTask = makeTask(this.logger, t[0]); this.backgroundGatherTask = makeTask(this.logger, t[0]);
this.backgroundGatherTask this.backgroundGatherTask

View File

@@ -190,7 +190,7 @@ class TaskGather extends Task {
} }
updateTimeout(timeout) { updateTimeout(timeout) {
this.logger.info(`TaskGather:updateTimout - updating timeout to ${timeout}`); this.logger.info(`TaskGather:updateTimeout - updating timeout to ${timeout}`);
this.timeout = timeout; this.timeout = timeout;
this._startTimer(); this._startTimer();
} }
@@ -317,6 +317,10 @@ class TaskGather extends Task {
_startTimer() { _startTimer() {
if (0 === this.timeout) return; if (0 === this.timeout) return;
if (this._timeoutTimer) {
clearTimeout(this._timeoutTimer);
this._timeoutTimer = null;
}
assert(!this._timeoutTimer); assert(!this._timeoutTimer);
this.logger.debug(`Gather:_startTimer: timeout ${this.timeout}`); this.logger.debug(`Gather:_startTimer: timeout ${this.timeout}`);
this._timeoutTimer = setTimeout(() => this._resolve('timeout'), this.timeout); this._timeoutTimer = setTimeout(() => this._resolve('timeout'), this.timeout);