CloudTranscriptionProvider.recordAndTranscribe() is blocking — needs async refactor and service integration #1
Labels
No labels
blocked:children
blocked:needs-decision
blocked:needs-human
blocked:verify-failed
bug
deferred
enhancement
feature-request
in-progress
needs-decompose
needs-triage
quickfix
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/transcriber#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
CloudTranscriptionProvider.recordAndTranscribe()usesThread.sleep()for chunk timing andOkHttp.newCall(request).execute()(blocking) for HTTP requests. It is designed to be called from a coroutine loop, but:Thread.sleep()blocks the calling thread — should usedelay()in asuspendfunctionOkHttp.execute()blocks — should useenqueue()orkotlinx.coroutineswithwithContext(Dispatchers.IO)TranscriptionService.ktdoesn't use theTranscriptionProviderabstraction at all — it still hardcodesandroid.speech.SpeechRecognizerdirectly. The cloud backend is never actually activated in the service loop, so this entire path is dead code in production.Location
app/src/main/java/com/voicetranscriber/service/CloudTranscriptionProvider.kt(lines 75–80, 102, 150)app/src/main/java/com/voicetranscriber/service/TranscriptionService.kt(lines 93–167)Suggested approach
recordAndTranscribe()asuspendfunction, replaceThread.sleep()withkotlinx.coroutines.delay(), and usewithContext(Dispatchers.IO)for the blocking HTTP callTranscriptionService.ktto useSpeechBackend.select()to pick a backend at startup, then run the appropriate continuous loop:ANDROID/FIREOS: existingSpeechRecognizercallback patternCLOUD: coroutine loop callingrecordAndTranscribe()and feeding results through the listenerBackendConfigfrom SharedPreferences at service startupsuspendCancellableCoroutinefor the OkHttp call if keeping the current HTTP clientPart of closing the gap between the provider abstraction layer and the actual service implementation.
Mark referenced this issue2026-05-13 05:38:08 +00:00
Fixed in commit. Closing.