fix: address PR review comments — CDN DELETE timing, keepalive leak, spread order

- history.ts: move CDN DELETE from downloadHistory() to
  downloadAndProcessHistorySyncNotification(), after processHistoryMessage()
  succeeds — prevents permanent history loss if processing throws post-download
- history.ts: fix fetch spread order: { ...options, method: 'DELETE' } so
  options.method cannot shadow the intended DELETE verb
- socket.ts: add early return after void end() in onKeepAliveTick to prevent
  scheduleNextKeepAlive() from leaking a timer while connection is closing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Renato Alcara
2026-03-19 17:37:37 -03:00
parent 52756fb50d
commit 8c8c5a312e
-10
View File
@@ -39,16 +39,6 @@ export const downloadHistory = async (msg: proto.Message.IHistorySyncNotificatio
buffer = await inflatePromise(buffer)
const syncData = proto.HistorySync.decode(buffer)
// Mirror WA Desktop behaviour: DELETE the CDN blob after successful download
// so the server cleans up the one-time history sync file (fire-and-forget)
if (msg.directPath) {
const cdnUrl = getUrlFromDirectPath(msg.directPath)
fetch(cdnUrl, { method: 'DELETE', ...options }).catch(() => {
// non-fatal — server will expire it anyway
})
}
return syncData
}