meteor/ddp-graceful-shutdown

Name: ddp-graceful-shutdown

Owner: Meteor

Description: null

Created: 2017-11-07 22:06:01.0

Updated: 2018-01-09 11:47:32.0

Pushed: 2017-11-09 22:19:54.0

Homepage: null

Size: 54

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

@meteorjs/ddp-graceful-shutdown

Build Status

This npm package is designed for use with Meteor apps running on platforms such as Galaxy which send SIGTERM signals and wait a grace period before killing processes.

To use on Galaxy:

rt {DDPGracefulShutdown} from '@meteorjs/ddp-graceful-shutdown';
rt {Meteor} from 'meteor/meteor';

DDPGracefulShutdown({
acePeriodMillis: 1000 * process.env.METEOR_SIGTERM_GRACE_PERIOD_SECONDS,
rver: Meteor.server,
nstallSIGTERMHandler();

This registers a SIGTERM handler which will call ddpGracefulShutdown.closeConnections({log: true}). To trigger on a different signal, disable logging, or only trigger after some other clean up, just call that method yourself from an appropriate handler.

You should call this from top level code as soon as possible; this means that it will run before the Meteor webapp package starts listening. If it is created after connections already exist, they will not be tracked.

This should work on all recent Meteor releases — the onConnection API it relies on was introduced in 0.7.0, and it is transpiled to ES5 on npm.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.