🔥 feat(listen): expose prefork RecoverInterval and ShutdownGracePeriod#4491
Conversation
fasthttp v1.72.0 (valyala/fasthttp#2199) added RecoverInterval and ShutdownGracePeriod to the prefork package. Fiber builds the prefork.Prefork struct internally, so users had no way to set them. Add PreforkRecoverInterval and PreforkShutdownGracePeriod to ListenConfig and pass them through. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
WalkthroughAdds two new time.Duration fields, PreforkRecoverInterval and PreforkShutdownGracePeriod, to ListenConfig. These are wired into the prefork.Prefork struct construction in app.prefork, documented in the config table, and set in an existing prefork test. ChangesPrefork timing configuration
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4491 +/- ##
==========================================
+ Coverage 92.91% 92.96% +0.04%
==========================================
Files 138 138
Lines 13609 13611 +2
==========================================
+ Hits 12645 12653 +8
+ Misses 597 592 -5
+ Partials 367 366 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR exposes newly added fasthttp prefork configuration knobs through Fiber’s ListenConfig, allowing callers to control crash-recovery backoff and master shutdown behavior when prefork mode is enabled.
Changes:
- Add
PreforkRecoverIntervalandPreforkShutdownGracePeriodtoListenConfig. - Wire the new fields into the internally constructed
prefork.Preforkinstance. - Update API docs and extend the existing prefork master-process test setup.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| prefork.go | Plumbs ListenConfig’s new prefork timing fields into prefork.Prefork. |
| prefork_test.go | Sets the new config fields in the prefork master-process test (but currently doesn’t assert their behavior). |
| listen.go | Introduces the two new ListenConfig fields with doc comments and JSON tags. |
| docs/api/fiber.md | Documents the new ListenConfig options in the public API table. |
fasthttp v1.72.0 (valyala/fasthttp#2199) added two new knobs to the prefork package. Fiber builds the
prefork.Preforkstruct internally, so users had no way to set them. This PR exposes both viaListenConfig:PreforkRecoverInterval(time.Duration): optional backoff before respawning a crashed child; zero keeps the previous immediate respawn.PreforkShutdownGracePeriod(time.Duration): how long the master waits for children after SIGTERM before SIGKILL on shutdown; zero keeps fasthttp's 5s default. Windows children are still killed immediately (fasthttp limitation).Docs table updated; both fields are exercised in
Test_App_Prefork_Master_Process.🤖 Generated with Claude Code