From b0c34cb5363c948eda8f9ea43119250fad2d350d Mon Sep 17 00:00:00 2001 From: Renato Alcara Date: Sun, 26 Apr 2026 15:25:41 -0300 Subject: [PATCH] chore(inbound): drop dead outer catch on postUpsertWork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses Copilot review on PR #392. Both tasks inside `postUpsertTasks` already swallow their rejections via `.catch`, so `Promise.all([taskA.catch, taskB.catch])` never rejects, and `postUpsertMutex.mutex(... postUpsertTasks)` therefore never rejects in practice. The outer `.catch` could only fire on AsyncMutex internal corruption — an extremely rare event, and one whose log message would be misleading ("background post-upsert work failed" pointing at the mutex layer, not the work). Replace with `void postUpsertWork`: marks the floating promise as intentional, and lets a truly unexpected rejection surface as an UnhandledPromiseRejection — a loud, attributable signal of a real bug rather than a swallowed warn buried in logs. --- src/Socket/chats.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 31cc052f..b1eb02fa 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -1509,17 +1509,13 @@ export const makeChatsSocket = (config: SocketConfig) => { ) } } else { - postUpsertWork.catch(err => - logger?.warn( - { - err, - messageId: msg.key?.id, - remoteJid: msg.key?.remoteJid, - shouldProcessHistoryMsg - }, - 'background post-upsert work failed' - ) - ) + // `postUpsertWork` cannot reject in practice — both tasks inside + // `postUpsertTasks` already swallow their rejections via `.catch`, + // so `Promise.all` never rejects. `void` marks the floating promise + // as intentional. If `postUpsertMutex` itself ever throws (e.g. + // runtime corruption), the resulting unhandled rejection is the + // signal we want — it's loud and points at a real bug. + void postUpsertWork } })