Commit ac4c435
TTS: fail fast + spread load across the Cloudflare worker farm
The 6-proxy farm 'rot' identically under concurrent load: a single worker's
synthesis jobs contend for CPU and trip Cloudflare's hard ~21s request
ceiling, so a weighted-down request wedges ~21s then dies. The rotator had no
per-worker timeout (fetch waited out the full ~21s kill) and #getBestWorker()
piled concurrent jobs onto one worker.
- #fetchWithTimeout(): 9s per-worker timeout (Promise.race), so a hung worker
fails fast and the loop rotates to the next worker.
- #getBestWorker(): random round-robin so concurrent requests spread across
the farm instead of stacking on the least-recently-used worker.
Recorded in CLAUDE.md self-correcting notes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent a097327 commit ac4c435
2 files changed
Lines changed: 40 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
90 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
91 | 126 | | |
92 | 127 | | |
93 | 128 | | |
| |||
205 | 240 | | |
206 | 241 | | |
207 | 242 | | |
208 | | - | |
| 243 | + | |
209 | 244 | | |
210 | 245 | | |
211 | 246 | | |
| |||
214 | 249 | | |
215 | 250 | | |
216 | 251 | | |
217 | | - | |
218 | | - | |
| 252 | + | |
219 | 253 | | |
220 | 254 | | |
221 | 255 | | |
| |||
0 commit comments