fix: add try/catch to delayed PreKey deletion to prevent unhandled rejection
The setTimeout async callback in removePreKey could cause unhandled promise rejection if the keystore was destroyed (connection closed) before the 5-min grace period expired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -847,7 +847,11 @@ function signalStorage(
|
||||
// Schedule deletion after grace period
|
||||
const timer = setTimeout(async () => {
|
||||
pendingPreKeyDeletions.delete(keyId)
|
||||
await keys.set({ 'pre-key': { [id]: null } })
|
||||
try {
|
||||
await keys.set({ 'pre-key': { [id]: null } })
|
||||
} catch {
|
||||
// Keystore may be destroyed if connection closed — safe to ignore
|
||||
}
|
||||
}, PREKEY_GRACE_PERIOD_MS)
|
||||
|
||||
pendingPreKeyDeletions.set(keyId, timer)
|
||||
|
||||
Reference in New Issue
Block a user