Skip to content

🔥 feat(listen): expose prefork RecoverInterval and ShutdownGracePeriod#4491

Merged
ReneWerner87 merged 1 commit into
mainfrom
claude/prefork-knobs-2199
Jul 2, 2026
Merged

🔥 feat(listen): expose prefork RecoverInterval and ShutdownGracePeriod#4491
ReneWerner87 merged 1 commit into
mainfrom
claude/prefork-knobs-2199

Conversation

@ReneWerner87

Copy link
Copy Markdown
Member

fasthttp v1.72.0 (valyala/fasthttp#2199) added two new knobs to the prefork package. Fiber builds the prefork.Prefork struct internally, so users had no way to set them. This PR exposes both via ListenConfig:

  • 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

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>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds 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.

Changes

Prefork timing configuration

Layer / File(s) Summary
Config fields and wiring
listen.go, prefork.go
ListenConfig gains PreforkRecoverInterval and PreforkShutdownGracePeriod fields with JSON tags; app.prefork passes these through to the prefork.Prefork struct literal alongside existing fields.
Docs and test coverage
docs/api/fiber.md, prefork_test.go
Config fields table documents the new options; existing prefork test sets both new fields with sample durations before invoking app.prefork.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • gofiber/fiber#4210: Both PRs modify fiber.ListenConfig and the app.prefork path that constructs fasthttp/prefork.Prefork, touching the same configuration-integration points.

Suggested reviewers: sixcolors, efectn, gaby

Poem

A rabbit tweaks the fork with glee,
Two new fields set timers free—
Recover soon, then grace to rest,
Master and child both do their best.
Hop, hop, deploy! 🐇⏱️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly states the problem, the new fields, docs update, and tests, with only template sections left unfilled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: exposing two prefork settings in ListenConfig.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/prefork-knobs-2199

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.96%. Comparing base (05919e5) to head (b6a9545).

Files with missing lines Patch % Lines
prefork.go 85.71% 0 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
unittests 92.96% <85.71%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PreforkRecoverInterval and PreforkShutdownGracePeriod to ListenConfig.
  • Wire the new fields into the internally constructed prefork.Prefork instance.
  • 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.

Comment thread prefork_test.go
@gaby gaby changed the title feat(listen): expose prefork RecoverInterval and ShutdownGracePeriod 🔥 feat(listen): expose prefork RecoverInterval and ShutdownGracePeriod Jul 1, 2026
@ReneWerner87 ReneWerner87 merged commit cdf4d24 into main Jul 2, 2026
24 of 25 checks passed
@ReneWerner87 ReneWerner87 deleted the claude/prefork-knobs-2199 branch July 2, 2026 06:37
@github-project-automation github-project-automation Bot moved this to Done in v3 Jul 2, 2026
@ReneWerner87 ReneWerner87 modified the milestones: v3, v3.4.0 Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants