Properly await termination.

(cherry picked from commit 4449737aed)
This commit is contained in:
Mark H. Wood
2023-08-22 15:46:55 -04:00
committed by github-actions[bot]
parent 15c2af5fbf
commit 46e2f4e22c

View File

@@ -536,10 +536,12 @@ function createHttpsServer(keys) {
// Graceful shutdown when signalled
const terminator = createHttpTerminator({server: listener});
process.on('SIGINT', ()=> {
console.debug('Closing HTTPS server on signal');
terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTPS server closed');
process.on('SIGINT', () => {
void (async ()=> {
console.debug('Closing HTTPS server on signal');
await terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTPS server closed');
})();
});
}
@@ -555,10 +557,12 @@ function run() {
// Graceful shutdown when signalled
const terminator = createHttpTerminator({server: listener});
process.on('SIGINT', ()=> {
console.debug('Closing HTTP server on signal');
terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTP server closed.');
process.on('SIGINT', () => {
void (async () => {
console.debug('Closing HTTP server on signal');
await terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTP server closed.');return undefined;
})();
});
}