Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/dual legs transcribe race condition #593

Merged
merged 5 commits into from
Jan 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/tasks/transcribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class TaskTranscribe extends SttTask {
/* buffer speech for continuous asr */
this._bufferedTranscripts = [];
this.bugname_prefix = 'transcribe_';
this.bugname_counter = 0;
}

get name() { return TaskName.Transcribe; }
Expand Down Expand Up @@ -265,7 +266,8 @@ class TaskTranscribe extends SttTask {
}
}
// save dedicated bugname for each endpoint
ep.transcribe_bugname = `${bugname}_${Date.now()}`;
ep.transcribe_bugname = `${bugname}_${channel}_${this.bugname_counter}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just

ep.transcribe_bugname = `${bugname}_${channel}_${this.bugname_counter++}`;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we can't use this,

first verb will have transcribe_bugname_1_0
LCC to move the call to new transcribe verb in listen will have same bug name again transcribe_bugname_1_0

in the meanwhile the first transcribe is still being closed, the 2nd transcribe save private data to same bug name again

Still Date.now() is a must to make sure every single time we have different bugname

this.bugname_counter++;
/* common handler for all stt engine errors */
this.addCustomEventListener(ep, JambonzTranscriptionEvents.Error, this._onJambonzError.bind(this, cs, ep));
await ep.set(opts)
Expand Down