Coder Social home page Coder Social logo

felixmosh / graceful Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ladjs/graceful

0.0 2.0 0.0 585 KB

Gracefully exit server (Koa), database (Mongo/Mongoose), Redis clients, and job scheduler (Redis/Bull)

Home Page: https://lad.js.org

License: MIT License

JavaScript 100.00%

graceful's Introduction

build status code coverage code style styled with prettier made with lass license

Gracefully exit server (Koa), database (Mongo/Mongoose), Redis clients, Bree job schedulers, and Bull job schedulers

Table of Contents

Install

npm:

npm install @ladjs/graceful

yarn:

yarn add @ladjs/graceful

Usage

Using this package will bind process event listeners when graceful.listen() is called:

  • process.on('warning') - will output via config.logger.warn
  • process.on('unhandledRejection') - will output via config.logger.error
  • process.once('uncaughtException') - will output via config.logger.error and process.exit(1) (does not exit gracefully)
  • process.on('message') - support Windows (e.g. signals not available) and listen for message of shutdown and then exit gracefully
  • process.once('SIGTERM') - will exit gracefully
  • process.once('SIGHUP') - will exit gracefully
  • process.once('SIGINT') - will exit gracefully
  • process.once('SIGUSR2') - will exit gracefully (nodemon support)

This package also prevents multiple process/SIG events from triggering multiple graceful exits. Only one graceful exit can occur at a time.

See one of these following files from Lad for the most up to date usage example:

You can also read more about Bree at https://github.com/breejs/bree.

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

graceful's People

Contributors

niftylettuce avatar felixmosh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.