From a22bc8ea4250d4dadca218ee17afc29dac210f9f Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Tue, 18 Apr 2023 21:58:30 -0400 Subject: [PATCH] fix issue where multiple gathers running simultaneously (#321) --- lib/session/call-session.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/session/call-session.js b/lib/session/call-session.js index d7c17298..6166fd4b 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -529,7 +529,7 @@ class CallSession extends Emitter { this.logger.info({currInput, newInput}, 'CallSession:enableBotMode - restarting background gather to apply new input type'); this.backgroundGatherTask.sticky = false; - this.disableBotMode(); + await this.disableBotMode(); } } this.backgroundGatherTask = task; @@ -568,12 +568,12 @@ class CallSession extends Emitter { this.logger.info({err, gather}, 'CallSession:enableBotMode - Error creating gather task'); } } - disableBotMode() { + async disableBotMode() { this._bargeInEnabled = false; if (this.backgroundGatherTask) { try { this.backgroundGatherTask.removeAllListeners(); - this.backgroundGatherTask.kill().catch((err) => {}); + await this.backgroundGatherTask.kill(); } catch (err) {} this.backgroundGatherTask = null; } @@ -724,7 +724,7 @@ class CallSession extends Emitter { } else { this.logger.info('CallSession:exec disabling bot mode to start gather with new options'); - this.disableBotMode(); + await this.disableBotMode(); } } if (!skip) {