Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nitro close hook not being called when stopping dev server #28188

Open
ChrisGV04 opened this issue Jul 16, 2024 · 1 comment
Open

Nitro close hook not being called when stopping dev server #28188

ChrisGV04 opened this issue Jul 16, 2024 · 1 comment

Comments

@ChrisGV04
Copy link
Contributor

Environment

Reproduction

https://stackblitz.com/edit/github-ftkhvf?file=server/plugins/shutdown.ts

Describe the bug

Even if I hook to the Nitro "close" lifecycle hook using a server plugin, the code inside the hook doesn't get called when stopping the dev server (npm run dev then Ctrl C). However, if I run the production build and stop it, the hook does get called correctly.

I would expect that the close hook gets called so I can perform a graceful shutdown of my database connections and queues even on development, but for now it only seems to work on the production build.

For some reason, the next time I start the dev server, the logs from the close hook get called on startup but not on close...

Additional context

No response

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants