Refactor request listeners to use async functions

This commit is contained in:
Zaid Humaimidi committed 2023-08-09 19:51:40 -07:00
1 parent 58488ebc3d
commit 7b8a49a7ba
11 files changed
+148 -163

No files matched your search

+9 -3
View File
@@ -95,7 +95,7 @@ if (!cluster.worker) {
exception: err,
pid: process.pid,
});
server.stop().then(exitWorkerGracefully).catch(exitWorkerUngracefully);
server.stop(false).then(exitWorkerGracefully).catch(exitWorkerUngracefully);
});
const initPromise = db
@@ -111,13 +111,19 @@ if (!cluster.worker) {
process.on("SIGINT", () => {
initPromise.finally(() => {
server.stop().then(exitWorkerGracefully).catch(exitWorkerUngracefully);
server
.stop(false)
.then(exitWorkerGracefully)
.catch(exitWorkerUngracefully);
});
});
process.on("SIGTERM", () => {
initPromise.finally(() => {
server.stop().then(exitWorkerGracefully).catch(exitWorkerUngracefully);
server
.stop(false)
.then(exitWorkerGracefully)
.catch(exitWorkerUngracefully);
});
});
}