mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 07:45:21 +00:00
fix: prevent phantom spaces and duplicates in message sync
- Add deduplication check when adding messages to retry queue - Prevent duplicate messages with same ID from being queued - Maintain proper message ordering during sync
This commit is contained in:
@@ -71,6 +71,16 @@ class MessageRetryService {
|
||||
return
|
||||
}
|
||||
|
||||
// Check if this message is already in the queue
|
||||
if let messageID = originalMessageID {
|
||||
let alreadyQueued = retryQueue.contains { msg in
|
||||
msg.originalMessageID == messageID
|
||||
}
|
||||
if alreadyQueued {
|
||||
return // Don't add duplicate
|
||||
}
|
||||
}
|
||||
|
||||
let retryMessage = RetryableMessage(
|
||||
id: UUID().uuidString,
|
||||
originalMessageID: originalMessageID,
|
||||
@@ -97,7 +107,7 @@ class MessageRetryService {
|
||||
}
|
||||
|
||||
private func processRetryQueue() {
|
||||
guard let meshService = meshService else { return }
|
||||
guard meshService != nil else { return }
|
||||
|
||||
let now = Date()
|
||||
var messagesToRetry: [RetryableMessage] = []
|
||||
|
||||
Reference in New Issue
Block a user