From 43564502f7aa2bf0f6d29889ae4e05f98eeea2d8 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Thu, 31 Mar 2022 13:07:58 -0400 Subject: [PATCH] fix assertion --- lib/session/call-session.js | 1 + lib/tasks/gather.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/session/call-session.js b/lib/session/call-session.js index b679590f..bec86df3 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -236,6 +236,7 @@ class CallSession extends Emitter { async enableBotMode(gather, autoEnable) { try { + gather.timeout = 0; // background gathers should not timeout const t = normalizeJambones(this.logger, [gather]); this.backgroundGatherTask = makeTask(this.logger, t[0]); this.backgroundGatherTask diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 5c280d65..1cee2f5c 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -190,7 +190,7 @@ class TaskGather extends Task { } updateTimeout(timeout) { - this.logger.info(`TaskGather:updateTimout - updating timeout to ${timeout}`); + this.logger.info(`TaskGather:updateTimeout - updating timeout to ${timeout}`); this.timeout = timeout; this._startTimer(); } @@ -317,6 +317,10 @@ class TaskGather extends Task { _startTimer() { if (0 === this.timeout) return; + if (this._timeoutTimer) { + clearTimeout(this._timeoutTimer); + this._timeoutTimer = null; + } assert(!this._timeoutTimer); this.logger.debug(`Gather:_startTimer: timeout ${this.timeout}`); this._timeoutTimer = setTimeout(() => this._resolve('timeout'), this.timeout);