fix: histsync LID improvements — raw_id mapping, prekeys, keepalive jitter, CDN DELETE
1. USyncQuery: extract raw_id attr from node attrs into rawId field; implement side_list parsing (was TODO/commented) reusing shared parseNodeList helper 2. getUSyncDevices: add 4th LID→PN source via raw_id pairing from device-list WA Business sends zero phoneNumberToLidMappings in HistorySync — raw_id is the only way to resolve LID↔PN for those accounts during message send 3. MIN_PREKEY_COUNT: 5 → 25 (WA Business maintains ~812; 5 was too low a buffer before triggering replenishment upload) 4. startKeepAliveRequest: replace fixed setInterval with recursive setTimeout + ±15% jitter, matching WA Desktop's ~25-30s variable heartbeat pattern; clearInterval → clearTimeout for the handle 5. downloadHistory: fire-and-forget DELETE to CDN after successful download, mirroring WA Desktop behaviour (server-side one-time file cleanup) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,16 @@ 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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user