{"_id":"@ardasevinc/fastify-graceful-shutdown","name":"@ardasevinc/fastify-graceful-shutdown","dist-tags":{"latest":"3.6.0"},"versions":{"3.6.0":{"name":"@ardasevinc/fastify-graceful-shutdown","version":"3.6.0","description":"Gracefully shutdown fastify","main":"index.js","scripts":{"format":"prettier ./*.js --write","test":"prettier ./*.js --debug-check && mocha && tsd","test:ts":"tsd","patch":"np patch --yolo","minor":"np minor --yolo","major":"np major --yolo"},"repository":{"type":"git","url":"git+https://github.com/ardasevinc/fastify-graceful-shutdown.git"},"keywords":["web","framework","clean","fastify","graceful","shutdown"],"author":{"name":"Arda Sevinç","email":"arda@ardasevinc.com","url":"https://github.com/ardasevinc"},"license":"ISC","bugs":{"url":"https://github.com/ardasevinc/fastify-graceful-shutdown/issues"},"engines":{"node":">=16.0.0"},"homepage":"https://github.com/ardasevinc/fastify-graceful-shutdown#readme","devDependencies":{"@types/node":"^18","chai":"^4.4.1","fastify":"^4.26.2","mocha":"^10.2.0","np":"^10.0.1","pre-commit":"^1.2.2","prettier":"^3.2.5","tsd":"^0.30.7"},"prettier":{"semi":false,"singleQuote":true},"dependencies":{"fastify-plugin":"^4.5.1","fastparallel":"^2.4.1"},"_id":"@ardasevinc/fastify-graceful-shutdown@3.6.0","gitHead":"8852c6fccf5767588c5ebb096c8cb8d191e899d9","types":"./index.d.ts","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-Uzx++D0CdjlI61aBBp5v96BjG17oRLrGISaHdTMhq2Br+NevwHGG4/piwArmdWJRHeThrkUH03afTsLSINOq5Q==","shasum":"4be67e0b6cf58ff49411ca4490c509893d1e3e9e","tarball":"https://registry.npmjs.org/@ardasevinc/fastify-graceful-shutdown/-/fastify-graceful-shutdown-3.6.0.tgz","fileCount":5,"unpackedSize":7384,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEqBRtliBwreI2/z36zgGhACl5wzGjVNrep/DRdDhKjcAiEAs23YeB83fg5rN7P+cmR/38iahnZ3hiFUGCAo49Ky9m8="}]},"_npmUser":{"name":"ardasevinc","email":"arda@ardasevinc.com"},"directories":{},"maintainers":[{"name":"ardasevinc","email":"arda@ardasevinc.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fastify-graceful-shutdown_3.6.0_1720001898357_0.35117690704551063"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-03T10:18:18.261Z","3.6.0":"2024-07-03T10:18:18.550Z","modified":"2024-07-03T10:18:18.807Z"},"maintainers":[{"name":"ardasevinc","email":"arda@ardasevinc.com"}],"description":"Gracefully shutdown fastify","homepage":"https://github.com/ardasevinc/fastify-graceful-shutdown#readme","keywords":["web","framework","clean","fastify","graceful","shutdown"],"repository":{"type":"git","url":"git+https://github.com/ardasevinc/fastify-graceful-shutdown.git"},"author":{"name":"Arda Sevinç","email":"arda@ardasevinc.com","url":"https://github.com/ardasevinc"},"bugs":{"url":"https://github.com/ardasevinc/fastify-graceful-shutdown/issues"},"license":"ISC","readme":"# 🏹 fastify-graceful-shutdown\n\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](#badge)\n[![NPM version](https://img.shields.io/npm/v/fastify-graceful-shutdown.svg?style=flat)](https://www.npmjs.com/package/fastify-graceful-shutdown)\n\nShutdown [Fastify](https://github.com/fastify/fastify) graceful asynchronously. By default the fastify `close` hook is called when `SIGINT` or `SIGTERM` was triggered.\n\n## Features\n\n- Graceful and debug friendly shutdown\n- Flush the fastify logger before process exit to avoid losing logs\n- Handlers are called in parallel for faster shutdown\n\n## Install\n\n```bash\nnpm install --save fastify-graceful-shutdown\n```\n\n## Register plugin\n\n```js\nfastify.register(require('fastify-graceful-shutdown'))\n```\n\n## Usage\n\n```js\nfastify.after(() => {\n  fastify.gracefulShutdown((signal, next) => {\n    fastify.log.info('Received signal to shutdown: %s', signal)\n    next()\n  })\n})\n```\n\n## Compatibility\n\nFastify >=3\n\n## Caveats\n\n- Don't register signal handlers otherwise except with this plugin.\n- Can't be used with a different logger other than [Pino](https://github.com/pinojs/pino) because we use the child logger feature to encapsulate the logs.\n- Use fastify `onClose` hook to release resources in your plugin.\n- The process will be exited after a certain timeout (Default 10 seconds) to protect against stuck process.\n","readmeFilename":"README.md"}