fix sync: INSERT OR IGNORE for duplicate messages, fix leaked IMAP continuations
- insertMessages uses INSERT OR IGNORE on (mailboxId, uid) conflict instead of crashing on UNIQUE constraint when messages are re-fetched after restart - IMAPResponseHandler.sendCommand resumes any leaked previous continuation before registering a new one, preventing DuplicateCommandTag errors - add channelInactive handler to resume pending continuations on connection drop - add error type to sync failure log for better diagnostics Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -207,8 +207,10 @@ final class MailViewModel {
|
||||
try await coordinator.syncNow()
|
||||
syncState = coordinator.syncState
|
||||
} catch {
|
||||
errorMessage = error.localizedDescription
|
||||
syncState = .error(error.localizedDescription)
|
||||
let desc = "\(type(of: error)): \(error.localizedDescription)"
|
||||
print("[MailViewModel] syncNow failed: \(desc)")
|
||||
errorMessage = desc
|
||||
syncState = .error(desc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user