hapi-graceful-pm2
hapi plugin to handle graceful pm2 reloads
Last updated 2 years ago by roylines .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hapi-graceful-pm2 
SYNC missed versions from official npm registry.

hapi-graceful-pm2

Circle CI Coverage Status npm version

This is a hapi plugin to handle true zero downtime reloads when issuing a pm2 reload command.

When using this plugin and calling 'pm2 reload', the 'SIGINT' message will be intercepted and will wait for hapi to drain all connections before exiting the worker. This will ensure any in progress requests are completed before exiting. Whilst waiting, no new requests will be forwarded to the worker.

Without this plugin the issuing of a reload will terminate any in progress requests without waiting. You can pass a timeout that configures the maximum time hapi should wait to drain all connections. Note: the PM2_GRACEFUL_TIMEOUT environment variable should be set to a value higher than the plugin timeout to ensure pm2 doesn't timeout before hapi.

The pm2 shutdown process is described here.

Usage

Register the plugin in the usual way, for instance:

server.register({  
    plugin: require('hapi-graceful-pm2'),
    options: {
        timeout: 4000
    }
}).then((err) => {
});

Current Tags

  • 1.0.17                                ...           latest (2 years ago)

6 Versions

  • 1.0.17                                ...           2 years ago
  • 1.0.15                                ...           4 years ago
  • 1.0.14                                ...           4 years ago
  • 1.0.12                                ...           5 years ago
  • 1.0.11                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |