From dd86875ea24f8ec9ee714b009104a667f667cbf8 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Wed, 31 Aug 2022 10:47:41 +0100 Subject: [PATCH] Update shutdown logging --- packages/cli/package.json | 2 +- packages/server/src/app.ts | 8 +++++--- packages/server/src/automations/bullboard.js | 1 + packages/server/src/threads/index.ts | 1 + packages/worker/src/index.ts | 4 +--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 22fac6dbf7..23f1be394f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -26,7 +26,7 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "1.1.32-alpha.6", + "@budibase/backend-core": "1.2.47", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/server/src/app.ts b/packages/server/src/app.ts index 62301d57ca..592892fbff 100644 --- a/packages/server/src/app.ts +++ b/packages/server/src/app.ts @@ -74,9 +74,7 @@ server.on("close", async () => { return } shuttingDown = true - if (!env.isTest()) { - console.log("Server Closed") - } + console.log("Server Closed") await automations.shutdown() await redis.shutdown() await events.shutdown() @@ -158,3 +156,7 @@ process.on("uncaughtException", err => { process.on("SIGTERM", () => { shutdown() }) + +process.on("SIGINT", () => { + shutdown() +}) diff --git a/packages/server/src/automations/bullboard.js b/packages/server/src/automations/bullboard.js index af091843f2..3aac6c4fed 100644 --- a/packages/server/src/automations/bullboard.js +++ b/packages/server/src/automations/bullboard.js @@ -53,6 +53,7 @@ exports.shutdown = async () => { await automationQueue.close() automationQueue = null } + console.log("Bull shutdown") } exports.queue = automationQueue diff --git a/packages/server/src/threads/index.ts b/packages/server/src/threads/index.ts index f112fdca5e..cee85e2815 100644 --- a/packages/server/src/threads/index.ts +++ b/packages/server/src/threads/index.ts @@ -106,5 +106,6 @@ export class Thread { static async shutdown() { await Thread.stopThreads() + console.log("Threads shutdown") } } diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index 7819fedeed..3f8be7c49d 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -63,9 +63,7 @@ server.on("close", async () => { return } shuttingDown = true - if (!env.isTest()) { - console.log("Server Closed") - } + console.log("Server Closed") await redis.shutdown() await events.shutdown() if (!env.isTest()) {