mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 11:50:56 +00:00
-fix holes [skip ci]
This commit is contained in:
parent
5cb5eab747
commit
21691c1382
@ -2913,37 +2913,38 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
|
|||||||
Logger.shared.log("State", "not adding hole for peer \(messageId.peerId), \(upperId) >= \(messageId.id) = false")
|
Logger.shared.log("State", "not adding hole for peer \(messageId.peerId), \(upperId) >= \(messageId.id) = false")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//TODO Please do not forget fix holes space.
|
||||||
|
|
||||||
// could be the reason for unbounded slowdown, needs investigation
|
// could be the reason for unbounded slowdown, needs investigation
|
||||||
for (peerIdAndNamespace, pts) in clearHolesFromPreviousStateForChannelMessagesWithPts {
|
// for (peerIdAndNamespace, pts) in clearHolesFromPreviousStateForChannelMessagesWithPts {
|
||||||
var upperMessageId: Int32?
|
// var upperMessageId: Int32?
|
||||||
var lowerMessageId: Int32?
|
// var lowerMessageId: Int32?
|
||||||
transaction.scanMessageAttributes(peerId: peerIdAndNamespace.peerId, namespace: peerIdAndNamespace.namespace, limit: 200, { id, attributes in
|
// transaction.scanMessageAttributes(peerId: peerIdAndNamespace.peerId, namespace: peerIdAndNamespace.namespace, limit: 200, { id, attributes in
|
||||||
for attribute in attributes {
|
// for attribute in attributes {
|
||||||
if let attribute = attribute as? ChannelMessageStateVersionAttribute {
|
// if let attribute = attribute as? ChannelMessageStateVersionAttribute {
|
||||||
if attribute.pts >= pts {
|
// if attribute.pts >= pts {
|
||||||
if upperMessageId == nil {
|
// if upperMessageId == nil {
|
||||||
upperMessageId = id.id
|
// upperMessageId = id.id
|
||||||
}
|
// }
|
||||||
if let lowerMessageIdValue = lowerMessageId {
|
// if let lowerMessageIdValue = lowerMessageId {
|
||||||
lowerMessageId = min(id.id, lowerMessageIdValue)
|
// lowerMessageId = min(id.id, lowerMessageIdValue)
|
||||||
} else {
|
// } else {
|
||||||
lowerMessageId = id.id
|
// lowerMessageId = id.id
|
||||||
}
|
// }
|
||||||
return true
|
// return true
|
||||||
} else {
|
// } else {
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return false
|
// return false
|
||||||
})
|
// })
|
||||||
if let upperMessageId = upperMessageId, let lowerMessageId = lowerMessageId {
|
// if let upperMessageId = upperMessageId, let lowerMessageId = lowerMessageId {
|
||||||
if upperMessageId != lowerMessageId {
|
// if upperMessageId != lowerMessageId {
|
||||||
transaction.removeHole(peerId: peerIdAndNamespace.peerId, namespace: peerIdAndNamespace.namespace, space: .everywhere, range: lowerMessageId ... upperMessageId)
|
// transaction.removeHole(peerId: peerIdAndNamespace.peerId, namespace: peerIdAndNamespace.namespace, space: .everywhere, range: lowerMessageId ... upperMessageId)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (threadMessageId, difference) in messageThreadStatsDifferences {
|
for (threadMessageId, difference) in messageThreadStatsDifferences {
|
||||||
updateMessageThreadStats(transaction: transaction, threadMessageId: threadMessageId, difference: difference.count, addedMessagePeers: difference.peers)
|
updateMessageThreadStats(transaction: transaction, threadMessageId: threadMessageId, difference: difference.count, addedMessagePeers: difference.peers)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user