New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

fastify-graceful-shutdown

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-graceful-shutdown

Gracefully shutdown fastify


Version published
Weekly downloads
13K
increased by3.04%
Maintainers
1
Weekly downloads
 
Created

🏹 fastify-graceful-shutdown

styled with prettier NPM version

Shutdown Fastify graceful asynchronously. By default the fastify close hook is called when SIGINT or SIGTERM was triggered.

Install

npm install --save fastify-graceful-shutdown

Register plugin

fastify.register(require('fastify-graceful-shutdown'))

Usage

fastify.gracefulShutdown((signal, next) => {
  next()
})

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.

FAQs

Package last updated on 04 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts