4.0.2 • Published 5 years ago
hemera-graceful-shutdown v4.0.2
Hemera-graceful-shutdown package
Shutdown Hemera graceful asynchronously. By default the hemera onClose
hook is called when SIGINT
or SIGTERM
was triggered.
Usage
const hemera = new Hemera(nats)
hemera.use(require('hemera-graceful-shutdown'))
hemera.gracefulShutdown((signal, next) => {
next()
})
Plugin decorators
- .gracefulShutdown(Function handler)
Caveats
- Don't register signal handlers otherwise except with this plugin.
- Use hemera
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.