Commit 9edc93c
committed
fix(shutdown): one grace-derived budget across all shutdown phases
The three serial shutdown phases (PGWire drain, gRPC drain, buffered-layer
flush + cursor snapshot) each had an independent 180s ceiling — assuming
540s of SIGTERM grace when prod's Docker StopGracePeriod is 60s. A hung
PGWire drain alone could eat the whole grace, so SIGKILL landed before the
flush or the clean cursor snapshot ever started, forcing reconcile + full
WAL replay on the next boot (2026-06-11 deploy).
TIMEFUSION_STOP_GRACE_SECS (default 50, sized for the 60s prod grace) is
now the total budget: drain phases get small caps (20%/10%) so they can't
starve the flush, and unused slack flows forward since the buffered layer
works off the same absolute deadline via shutdown_by(). The snapshot keeps
a reserved 20% slice of whatever remains.
Replaces TIMEFUSION_SHUTDOWN_TIMEOUT_SECS; remove it from app envs and set
TIMEFUSION_STOP_GRACE_SECS to ~80% of StopGracePeriod if raising the grace.1 parent eb13a36 commit 9edc93c
3 files changed
Lines changed: 49 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1366 | 1366 | | |
1367 | 1367 | | |
1368 | 1368 | | |
1369 | | - | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
1370 | 1372 | | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
1371 | 1378 | | |
1372 | 1379 | | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
1382 | 1390 | | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1386 | 1394 | | |
1387 | 1395 | | |
1388 | 1396 | | |
| |||
1769 | 1777 | | |
1770 | 1778 | | |
1771 | 1779 | | |
1772 | | - | |
| 1780 | + | |
1773 | 1781 | | |
1774 | 1782 | | |
1775 | 1783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
| |||
414 | 417 | | |
415 | 418 | | |
416 | 419 | | |
417 | | - | |
418 | | - | |
| 420 | + | |
| 421 | + | |
419 | 422 | | |
420 | 423 | | |
421 | 424 | | |
| |||
518 | 521 | | |
519 | 522 | | |
520 | 523 | | |
521 | | - | |
522 | | - | |
523 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
524 | 527 | | |
525 | 528 | | |
526 | 529 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
373 | 381 | | |
374 | | - | |
375 | | - | |
| 382 | + | |
376 | 383 | | |
377 | 384 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
| 385 | + | |
382 | 386 | | |
383 | 387 | | |
384 | 388 | | |
385 | | - | |
386 | | - | |
| 389 | + | |
387 | 390 | | |
388 | 391 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
| 392 | + | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
0 commit comments