Skip to content

✨ feat: Added optional production graceful shutdown for bun adapter.#196

Merged
rphlmr merged 2 commits intorphlmr:mainfrom
holmok:main
Feb 17, 2026
Merged

✨ feat: Added optional production graceful shutdown for bun adapter.#196
rphlmr merged 2 commits intorphlmr:mainfrom
holmok:main

Conversation

@holmok
Copy link
Contributor

@holmok holmok commented Feb 16, 2026

Addresses #195

Description

This adds an item to the Bun options in createHonoServer to enable an optional production graceful shutdown handler that cleans up resources after HTTP connections are closed and all requests have completed.

Includes an example.

export default createHonoServer({
  onGracefulShutdown: async () => {
    await db.close();
  },
});

Type of change

Please mark relevant options with an x in the brackets.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Algorithm update - updates algorithm documentation/questions/answers etc.
  • Other (please describe):

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
list any relevant details for your test configuration

  • Integration tests
  • Unit tests
  • Manual tests
  • No tests required

Reviewer checklist

Mark everything that needs to be checked before merging the PR.

  • Check if the UI is working as expected and is satisfactory
  • Check if the code is well documented
  • Check if the behavior is what is expected
  • Check if the code is well tested
  • Check if the code is readable and well formatted
  • Additional checks (document below if any)

Screenshots (if appropriate):

Screenshot 2026-02-15 at 7 51 56 PM

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 16, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/rphlmr/react-router-hono-server@196

commit: 046b211

@rphlmr
Copy link
Owner

rphlmr commented Feb 16, 2026

Thanks for your pull request!

I will take a look ASAP, in the meantime a temporary release is available

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an optional “production graceful shutdown” hook to the Bun adapter so consumers can run cleanup after the HTTP server is stopped, and includes a new Bun example plus README updates.

Changes:

  • Add onGracefulShutdown option to Bun adapter options and attempt to wire SIGINT/SIGTERM handling in production.
  • Add a new examples/bun/graceful-shutdown project demonstrating the feature.
  • Document the new option in the root README and add a changeset for a minor release.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

File Description
src/adapters/bun.ts Introduces onGracefulShutdown option and production signal/shutdown logic.
README.md Documents the new Bun option in the Bun adapter options section.
examples/bun/graceful-shutdown/* New example app/config demonstrating graceful shutdown usage.
.changeset/bold-jars-cheer.md Declares a minor version bump for the new feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rphlmr
Copy link
Owner

rphlmr commented Feb 16, 2026

Do not bother too much with AI reviews, it was initially just to try this feature 👀

@rphlmr rphlmr merged commit 8a64698 into rphlmr:main Feb 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants