Fix process shutdown issues

This commit is contained in:
Zaid Abdulla committed 2019-09-23 16:03:08 -07:00
1 parent 4bcee572f1
commit ed0aa8ae7a
9 files changed
+63 -44

No files matched your search

+8 -5
View File
@@ -36,11 +36,14 @@ const SERVICE_ADDRESS = config.get("UI_INTERFACE");
const SERVICE_PORT = config.get("UI_PORT");
function exitWorkerGracefully(): void {
db.disconnect();
db2.disconnect();
cache.disconnect();
extensions.killAll();
cluster.worker.disconnect();
setTimeout(exitWorkerUngracefully, 5000).unref();
Promise.all([
db.disconnect(),
db2.disconnect(),
cache.disconnect(),
extensions.killAll(),
cluster.worker.disconnect()
]).catch(exitWorkerUngracefully);
}
function exitWorkerUngracefully(): void {