mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-15 10:49:07 +00:00
fix microsoft stt max client buffer size error for transcribe verb (#1173)
This commit is contained in:
@@ -653,12 +653,21 @@ class TaskTranscribe extends SttTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onMaxDurationExceeded(cs, ep, channel) {
|
_onMaxDurationExceeded(cs, ep, channel) {
|
||||||
this.logger.debug(`TaskTranscribe:_onMaxDurationExceeded on channel ${channel}`);
|
this.restartDueToError(ep, channel, 'Max duration exceeded');
|
||||||
|
}
|
||||||
|
|
||||||
|
_onMaxBufferExceeded(cs, ep, channel) {
|
||||||
|
this.restartDueToError(ep, channel, 'Max buffer exceeded');
|
||||||
|
}
|
||||||
|
|
||||||
|
restartDueToError(ep, channel, reason) {
|
||||||
|
this.logger.debug(`TaskTranscribe:${reason} on channel ${channel}`);
|
||||||
if (this.paused) return;
|
if (this.paused) return;
|
||||||
|
|
||||||
if (this.childSpan[channel - 1] && this.childSpan[channel - 1].span) {
|
if (this.childSpan[channel - 1] && this.childSpan[channel - 1].span) {
|
||||||
this.childSpan[channel - 1].span.setAttributes({
|
this.childSpan[channel - 1].span.setAttributes({
|
||||||
channel,
|
channel,
|
||||||
'stt.resolve': 'max duration exceeded',
|
'stt.resolve': reason,
|
||||||
'stt.label': this.label || 'None',
|
'stt.label': this.label || 'None',
|
||||||
});
|
});
|
||||||
this.childSpan[channel - 1].span.end();
|
this.childSpan[channel - 1].span.end();
|
||||||
@@ -715,6 +724,14 @@ class TaskTranscribe extends SttTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.logger.info({evt}, 'TaskTranscribe:_onJambonzError');
|
this.logger.info({evt}, 'TaskTranscribe:_onJambonzError');
|
||||||
|
if (this.vendor === 'microsoft' &&
|
||||||
|
evt.error?.includes('Due to service inactivity, the client buffer exceeded maximum size. Resetting the buffer')) {
|
||||||
|
let channel = 1;
|
||||||
|
if (this.ep !== _ep) {
|
||||||
|
channel = 2;
|
||||||
|
}
|
||||||
|
return this._onMaxBufferExceeded(cs, _ep, channel);
|
||||||
|
}
|
||||||
if (this.paused) return;
|
if (this.paused) return;
|
||||||
const {writeAlerts, AlertType} = cs.srf.locals;
|
const {writeAlerts, AlertType} = cs.srf.locals;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user