Fix/google race condition gather (#743)

* lint

* logging

* wip
This commit is contained in:
Dave Horton
2024-05-03 12:53:26 -04:00
committed by GitHub
parent 56b8f0623b
commit dfe623e78a

View File

@@ -591,7 +591,6 @@ class TaskGather extends SttTask {
} }
_killActionHookDelayAction() { _killActionHookDelayAction() {
this.logger.debug('_killActionHookDelayAction');
if (this._actionHookDelaySayTask && !this._actionHookDelaySayTask.killed) { if (this._actionHookDelaySayTask && !this._actionHookDelaySayTask.killed) {
this._actionHookDelaySayTask.removeAllListeners('playDone'); this._actionHookDelaySayTask.removeAllListeners('playDone');
this._actionHookDelaySayTask.kill(this.cs); this._actionHookDelaySayTask.kill(this.cs);
@@ -1037,6 +1036,16 @@ class TaskGather extends SttTask {
async _resolve(reason, evt) { async _resolve(reason, evt) {
this.logger.debug(`TaskGather:resolve with reason ${reason}`); this.logger.debug(`TaskGather:resolve with reason ${reason}`);
if (this.needsStt && this.ep && this.ep.connected) {
this.ep.stopTranscription({
vendor: this.vendor,
bugname: this.bugname
})
.catch((err) => {
if (this.resolved) return;
this.logger.error({err}, 'Error stopping transcription');
});
}
if (this.resolved) return; if (this.resolved) return;
this.resolved = true; this.resolved = true;
@@ -1054,13 +1063,6 @@ class TaskGather extends SttTask {
'stt.resolve': reason, 'stt.resolve': reason,
'stt.result': JSON.stringify(evt) 'stt.result': JSON.stringify(evt)
}); });
if (this.needsStt && this.ep && this.ep.connected) {
this.ep.stopTranscription({
vendor: this.vendor,
bugname: this.bugname
})
.catch((err) => this.logger.error({err}, 'Error stopping transcription'));
}
if (this.callSession && this.callSession.callGone) { if (this.callSession && this.callSession.callGone) {
this.logger.debug('TaskGather:_resolve - call is gone, not invoking web callback'); this.logger.debug('TaskGather:_resolve - call is gone, not invoking web callback');