From bedc25bacff14fcb54bc592cb945c232e9188719 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Thu, 2 Jan 2025 04:27:52 +0100 Subject: [PATCH] fix(api): :bug: Properly await notification result --- classes/workers/push.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/workers/push.ts b/classes/workers/push.ts index cc50721b..4ea1920c 100644 --- a/classes/workers/push.ts +++ b/classes/workers/push.ts @@ -18,6 +18,10 @@ export const getPushWorker = (): Worker => data: { psId, relatedUserId, type, noteId, notificationId }, } = job; + await job.log( + `Sending push notification for note [${notificationId}]`, + ); + const ps = await PushSubscription.fromId(psId); if (!ps) { @@ -87,7 +91,7 @@ export const getPushWorker = (): Worker => ? htmlToText(note.data.spoilerText || note.data.content) : htmlToText(relatedUser.data.note); - sendNotification( + await sendNotification( { endpoint: ps.data.endpoint, keys: { @@ -115,6 +119,10 @@ export const getPushWorker = (): Worker => }, }, ); + + await job.log( + `✔ Finished delivering push notification for note [${notificationId}]`, + ); }, { connection,