From 5760e0ffe8d6c7c72d38e270774890ed2e7a87bd Mon Sep 17 00:00:00 2001 From: Grant Timmerman Date: Tue, 30 Mar 2021 20:29:35 -0500 Subject: [PATCH 1/2] fix: smooth functions crash Signed-off-by: Grant Timmerman --- src/invoker.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/invoker.ts b/src/invoker.ts index 550760ea..cba7a070 100644 --- a/src/invoker.ts +++ b/src/invoker.ts @@ -272,10 +272,13 @@ export class ErrorHandler { ['SIGINT', 'SIGTERM'].forEach(signal => { process.on(signal as NodeJS.Signals, () => { - console.log(`Received ${signal}`); - this.server.close(() => { - // eslint-disable-next-line no-process-exit - process.exit(); + sendCrashResponse({ + err: new Error(`Received ${signal}`), + res: latestRes, + silent: true, + callback: () => { + process.exit(); + } }); }); }); From 3a6089fae4f97aa971fc088d55b7ed785173392b Mon Sep 17 00:00:00 2001 From: Grant Timmerman Date: Tue, 30 Mar 2021 20:40:17 -0500 Subject: [PATCH 2/2] fix: process exit Signed-off-by: Grant Timmerman --- src/invoker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/invoker.ts b/src/invoker.ts index cba7a070..2f33680b 100644 --- a/src/invoker.ts +++ b/src/invoker.ts @@ -277,8 +277,9 @@ export class ErrorHandler { res: latestRes, silent: true, callback: () => { + // eslint-disable-next-line no-process-exit process.exit(); - } + }, }); }); });