Commit b2cf71d
Add ELECTRIC_TCP_READ_TIMEOUT for the HTTP keep-alive idle timeout (#4716)
## What
Adds `ELECTRIC_TCP_READ_TIMEOUT` to configure ThousandIsland's
`read_timeout` (default 60s), which doubles as Bandit's HTTP keep-alive
idle timeout: connections that have waited this long for their next
request are closed. The option mirrors `ELECTRIC_TCP_SEND_TIMEOUT`
(human-readable duration) and threads through `tcp_read_timeout` →
`thousand_island_options/1`. Default is unchanged (`nil` →
ThousandIsland's 60s).
Includes a docs entry in `website/docs/sync/api/config.md` and a
changeset.
## Why
When Electric runs behind a connection-pooling proxy, the target's
keep-alive timeout must **exceed** the proxy's idle timeout. If it
doesn't, the proxy can reuse a pooled connection at the same moment
Bandit's idle timer closes it (the close is a bare FIN — nothing
announces it in-band), and the resulting TCP reset surfaces to clients
as an intermittent `502 Bad Gateway`.
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent a1026bd commit b2cf71d
6 files changed
Lines changed: 46 additions & 1 deletion
File tree
- .changeset
- packages/sync-service
- config
- lib/electric
- test/electric
- website/docs/sync/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| 302 | + | |
| 303 | + | |
302 | 304 | | |
303 | 305 | | |
304 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
369 | 375 | | |
370 | 376 | | |
371 | 377 | | |
| |||
383 | 389 | | |
384 | 390 | | |
385 | 391 | | |
386 | | - | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
288 | 300 | | |
289 | 301 | | |
290 | 302 | | |
| |||
0 commit comments