Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastify-graceful-shutdown

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-graceful-shutdown

Gracefully shutdown fastify

  • 3.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11K
decreased by-15.16%
Maintainers
1
Weekly downloads
 
Created
Source

🏹 fastify-graceful-shutdown


Note: If you are looking for a simple generic module to run shutdown logic, I recommend using close-with-grace. fastify-graceful-shutdown goes an opinionated way, and does want to solve all use cases.


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.after(() => {
  fastify.gracefulShutdown((signal, next) => {
    console.log('Upps!')
    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.

Keywords

FAQs

Package last updated on 23 Jul 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc