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

+6 -3
View File
@@ -34,9 +34,12 @@ const SERVICE_ADDRESS = config.get("FS_INTERFACE");
const SERVICE_PORT = config.get("FS_PORT");
function exitWorkerGracefully(): void {
db.disconnect();
cache.disconnect();
cluster.worker.disconnect();
setTimeout(exitWorkerUngracefully, 5000).unref();
Promise.all([
db.disconnect(),
cache.disconnect(),
cluster.worker.disconnect()
]).catch(exitWorkerUngracefully);
}
function exitWorkerUngracefully(): void {