Add Caught signal ... messages
Container log when sending a `SIGHUP` signal and then a `SIGTERM` signal using `docker kill --signal ...` : ``` Starting tileserver-gl v4.4.8 [INFO] Automatically creating config file for zurich_switzerland.mbtiles [INFO] Only a basic preview style will be used. [INFO] See documentation to learn how to create config.json file. Run with --verbose to see the config file here. Starting server Listening at http://[::]:8080/ Startup complete Caught signal SIGHUP, refreshing Stopping server and reloading config Starting server Listening at http://[::]:8080/ Startup complete Caught signal SIGTERM, stopping gracefully ``` Note that the numeric signal values, as used in the shell version, were replaced by signal names, as used in nodeJS.
This commit is contained in:
parent
554f1f7076
commit
096fef9b0a
1 changed files with 13 additions and 8 deletions
|
|
@ -590,6 +590,15 @@ function start(opts) {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the server gracefully
|
||||
* @param {string} signal Name of the received signal
|
||||
*/
|
||||
function stopGracefully(signal) {
|
||||
console.log(`Caught signal ${signal}, stopping gracefully`);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param opts
|
||||
|
|
@ -602,15 +611,11 @@ export function server(opts) {
|
|||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
process.exit();
|
||||
});
|
||||
process.on('SIGINT', stopGracefully);
|
||||
process.on('SIGTERM', stopGracefully);
|
||||
|
||||
process.on('SIGTERM', () => {
|
||||
process.exit();
|
||||
});
|
||||
|
||||
process.on('SIGHUP', () => {
|
||||
process.on('SIGHUP', (signal) => {
|
||||
console.log(`Caught signal ${signal}, refreshing`);
|
||||
console.log('Stopping server and reloading config');
|
||||
|
||||
running.server.shutdown(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue