mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 13:25:20 +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
|
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(
|
let retryMessage = RetryableMessage(
|
||||||
id: UUID().uuidString,
|
id: UUID().uuidString,
|
||||||
originalMessageID: originalMessageID,
|
originalMessageID: originalMessageID,
|
||||||
@@ -97,7 +107,7 @@ class MessageRetryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func processRetryQueue() {
|
private func processRetryQueue() {
|
||||||
guard let meshService = meshService else { return }
|
guard meshService != nil else { return }
|
||||||
|
|
||||||
let now = Date()
|
let now = Date()
|
||||||
var messagesToRetry: [RetryableMessage] = []
|
var messagesToRetry: [RetryableMessage] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user