Commit 5a3fbc2
committed
Fix transcription hanging indefinitely when Groq stalls after TCP accept
URLSession's timeoutInterval does not reliably fire when a server
accepts the TCP connection but then stops responding before sending any
data. In that situation the upload call in transcribeAudio() hangs
forever, blocking the entire recording pipeline with no user feedback
and no way to recover short of force-quitting the app.
PostProcessingService already avoids this by racing the API call against
a Task.sleep timer inside a withThrowingTaskGroup — whichever finishes
first wins, and the loser is cancelled. Apply the same pattern to
TranscriptionService.transcribe() so the timeout is enforced by Swift
concurrency rather than URLSession heuristics.
The timeout duration is unchanged (transcriptionTimeoutSeconds, default
20 s). The error thrown is the existing TranscriptionError.transcriptionTimedOut.1 parent e25b45b commit 5a3fbc2
1 file changed
Lines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
60 | 80 | | |
61 | 81 | | |
62 | 82 | | |
| |||
0 commit comments