3.5.3 • Published 1 month ago
fastify-graceful-shutdown v3.5.3
🏹 fastify-graceful-shutdown
Shutdown Fastify graceful asynchronously. By default the fastify close
hook is called when SIGINT
or SIGTERM
was triggered.
Features
- Graceful and debug friendly shutdown
- Flush the fastify logger before process exit to avoid losing logs
- Handlers are called in parallel for faster shutdown
Install
npm install --save fastify-graceful-shutdown
Register plugin
fastify.register(require('fastify-graceful-shutdown'))
Usage
fastify.after(() => {
fastify.gracefulShutdown((signal, next) => {
fastify.log.info('Received signal to shutdown: %s', signal)
next()
})
})
Compatibility
Fastify >=3
Caveats
- Don't register signal handlers otherwise except with this plugin.
- Can't be used with a different logger other than Pino because we use the child logger feature to encapsulate the logs.
- Use fastify
onClose
hook to release resources in your plugin. - The process will be exited after a certain timeout (Default 10 seconds) to protect against stuck process.
3.5.3
1 month ago
3.5.2
1 month ago
3.5.1
9 months ago
3.4.2
9 months ago
3.5.0
9 months ago
3.4.1
9 months ago
3.4.0
2 years ago
3.3.0
2 years ago
3.2.0
2 years ago
3.1.0
3 years ago
3.0.0
4 years ago
2.0.1
5 years ago
2.0.0
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.0
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago