This commit is contained in:
Quan HL
2023-08-17 17:04:38 +07:00
parent 541cb1458d
commit a97d99650c

View File

@@ -163,6 +163,7 @@ class TaskSay extends Task {
executedLanguage = language; executedLanguage = language;
} catch (error) { } catch (error) {
let isFallbackSuccess = false;
if (fallbackVendor) { if (fallbackVendor) {
const fallbackcredentials = cs.getSpeechCredentials(fallbackVendor, 'tts', fallbackLabel); const fallbackcredentials = cs.getSpeechCredentials(fallbackVendor, 'tts', fallbackLabel);
const {span: fallbackSpan} = this.startChildSpan('fallback-tts-generation', { const {span: fallbackSpan} = this.startChildSpan('fallback-tts-generation', {
@@ -184,6 +185,7 @@ class TaskSay extends Task {
credentials: fallbackcredentials, credentials: fallbackcredentials,
disableTtsCache : this.disableTtsCache disableTtsCache : this.disableTtsCache
}); });
isFallbackSuccess = true;
fallbackSpan.setAttributes({'tts.cached': servedFromCache}); fallbackSpan.setAttributes({'tts.cached': servedFromCache});
fallbackSpan.end(); fallbackSpan.end();
@@ -211,7 +213,7 @@ class TaskSay extends Task {
}).catch((err) => this.logger.info({err}, 'Error generating alert for fallback tts failure')); }).catch((err) => this.logger.info({err}, 'Error generating alert for fallback tts failure'));
} }
} }
if (!isFallbackSuccess) {
this.logger.info({error}, 'Error synthesizing tts'); this.logger.info({error}, 'Error synthesizing tts');
span.end(); span.end();
writeAlerts({ writeAlerts({
@@ -223,6 +225,7 @@ class TaskSay extends Task {
this.notifyError({msg: 'TTS error', details: error.message || error}); this.notifyError({msg: 'TTS error', details: error.message || error});
return; return;
} }
}
this.logger.debug(`file ${filePathUrl}, served from cache ${isFromCache}`); this.logger.debug(`file ${filePathUrl}, served from cache ${isFromCache}`);
if (filePathUrl) cs.trackTmpFile(filePathUrl); if (filePathUrl) cs.trackTmpFile(filePathUrl);