Skip to content

fix(transcription): scale local transcription timeouts with audio duration#1104

Open
xAlcahest wants to merge 1 commit into
OpenWhispr:mainfrom
xAlcahest:fix/local-transcription-timeout
Open

fix(transcription): scale local transcription timeouts with audio duration#1104
xAlcahest wants to merge 1 commit into
OpenWhispr:mainfrom
xAlcahest:fix/local-transcription-timeout

Conversation

@xAlcahest

Copy link
Copy Markdown
Collaborator

Summary

Local transcription dies after exactly 5 minutes on long recordings: the local single-request paths hardcode a 300000 ms request timeout (whisperServer.js POST /inference, parakeetWsServer.js transcribe, llama post-processing, diarization), and the wall is on inference time, so a long file on a slow CPU with a big model gets killed mid-transcription. The new src/helpers/transcriptionTimeout.js scales the timeout with the estimated audio duration (max(300000, seconds * 10000), with a 24-hour ceiling to stay under the 32-bit setTimeout limit) and uses a flat 60-minute cap where duration is not cheaply available, so short dictations keep exactly today's behavior and a genuinely hung server still fails eventually.

Fixes #976

Changes

  • src/helpers/transcriptionTimeout.js: new shared module with the floor, per-second, flat-cap and ceiling constants plus computeTranscriptionTimeoutMs()
  • src/helpers/whisperServer.js: /inference request timeout scales with the converted WAV buffer duration
  • src/helpers/parakeetWsServer.js: per-call timeout computed from the sample buffer instead of the flat 5-minute constant
  • src/helpers/llamaServer.js: post-processing timeout uses the 60-minute flat cap since no audio duration exists there
  • src/helpers/diarization.js: per-run timeout derived from the WAV file size, falling back to the flat cap
  • test/helpers/transcriptionTimeout.test.js: floor, scaling, ceiling and invalid-input coverage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server timeout after exactly 5 minutes during audio transcription

1 participant