diff options
author | Rainer Rillke <rillke@wikipedia.de> | 2017-11-04 22:59:19 +0100 |
---|---|---|
committer | Luiza Pagliari <lpagliari@gmail.com> | 2017-11-04 19:59:19 -0200 |
commit | f12debd5c72314e6f05bf3acc738d7d44a1bcb1b (patch) | |
tree | d24465b4b371de5779eb99394319ef5b5525e5de /src | |
parent | 32027134cbe4e37ced89091bf05e9fd07980ca12 (diff) | |
download | etherpad-lite-f12debd5c72314e6f05bf3acc738d7d44a1bcb1b.zip |
Catch SIGTERM for graceful shutdown (#3266)
Shut down database connection and exit the node process
when SIGTERM is encountered. This is especially important
when nodejs is run as PID1, e.g. in a docker container.
Shutting down connections to clients (browsers) is beyond
this patche's scope.
Resolves #3265
Diffstat (limited to 'src')
-rw-r--r-- | src/node/hooks/express/errorhandling.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/node/hooks/express/errorhandling.js b/src/node/hooks/express/errorhandling.js index 7afe80ae..c36595bd 100644 --- a/src/node/hooks/express/errorhandling.js +++ b/src/node/hooks/express/errorhandling.js @@ -49,5 +49,8 @@ exports.expressCreateServer = function (hook_name, args, cb) { //sigint is so far not working on windows //https://github.com/joyent/node/issues/1553 process.on('SIGINT', exports.gracefulShutdown); + // when running as PID1 (e.g. in docker container) + // allow graceful shutdown on SIGTERM c.f. #3265 + process.on('SIGTERM', exports.gracefulShutdown); } } |