Skip to content

Commit

Permalink
Use if/else instead of return so finally executes
Browse files Browse the repository at this point in the history
  • Loading branch information
timjrobinson committed Sep 4, 2023
1 parent 71731f4 commit 2373af2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions worker/job-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ class WokerQueue {
public async sendWithInterval(json: string, intervalMs: number, deDuplicationId?: string): Promise<void> {
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);
Expand Down

0 comments on commit 2373af2

Please sign in to comment.