kill only after 2s

This commit is contained in:
akirilyuk
2022-02-03 18:42:03 +01:00
parent cc67132dfa
commit 2fc3febcf6

View File

@@ -100,21 +100,20 @@ class TaskGather extends Task {
try {
if (this.sayTask) {
this.logger.debug('Gather: kicking off say task');
this.sayTask.exec(cs, ep).then(() => {
this.logger.debug('Gather: completed say task promise');
this.sayTask.exec(cs, ep);
this.sayTask.on('playDone', async(err) => {
if (err) return this.logger.error({err}, 'Gather:exec Error playing tts');
this.logger.debug('Gather: say task completed');
if (!this.killed) {
if (this.listenAfterSpeech) {
startListening(cs, ep);
} else {
setTimeout(()=>{
this.kill(cs);
}
}
return;
}).catch(err => this.logger.error({err}, 'Gather: failed to play say task')); // kicked off, _not_ waiting for it to complete
this.sayTask.on('playDone', async(err) => {
if (err) return this.logger.error({err}, 'Gather:exec Error playing tts');
this.logger.debug('Gather: say task completed');
},2000)
}
}
});
}
else if (this.playTask) {