From 2373af274106b16aaf9cfeaab91543641dc383dc Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Mon, 4 Sep 2023 22:05:31 +1000 Subject: [PATCH] Use if/else instead of return so finally executes --- worker/job-queue.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worker/job-queue.ts b/worker/job-queue.ts index c90c52629..72a88b281 100644 --- a/worker/job-queue.ts +++ b/worker/job-queue.ts @@ -10,9 +10,10 @@ class WokerQueue { public async sendWithInterval(json: string, intervalMs: number, deDuplicationId?: string): Promise { try { if (env.WORKER_QUEUE_URL.match(/localhost/)) { - return this.sendLocalMessage(json ); + await this.sendLocalMessage(json ); + } else { + await this.sendMessage(json, deDuplicationId); } - await this.sendMessage(json, deDuplicationId); console.log(`Sent message to schedule job on queue ${env.WORKER_QUEUE_URL}: ${json}`); } catch (error) { console.log(error);