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

+7 -4
View File
@@ -35,10 +35,13 @@ const SERVICE_ADDRESS = config.get("CWMP_INTERFACE");
const SERVICE_PORT = config.get("CWMP_PORT");
function exitWorkerGracefully(): void {
db.disconnect();
cache.disconnect();
extensions.killAll();
cluster.worker.disconnect();
setTimeout(exitWorkerUngracefully, 5000).unref();
Promise.all([
db.disconnect(),
cache.disconnect(),
extensions.killAll(),
cluster.worker.disconnect()
]).catch(exitWorkerUngracefully);
}
function exitWorkerUngracefully(): void {
+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 {
+7 -4
View File
@@ -35,10 +35,13 @@ const SERVICE_ADDRESS = config.get("NBI_INTERFACE");
const SERVICE_PORT = config.get("NBI_PORT");
function exitWorkerGracefully(): void {
db.disconnect();
cache.disconnect();
extensions.killAll();
cluster.worker.disconnect();
setTimeout(exitWorkerUngracefully, 5000).unref();
Promise.all([
db.disconnect(),
cache.disconnect(),
extensions.killAll(),
cluster.worker.disconnect()
]).catch(exitWorkerUngracefully);
}
function exitWorkerUngracefully(): void {
+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 {