mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
added log for slow db
This commit is contained in:
parent
636f35cb8e
commit
2f8fbd5fcd
@ -2999,6 +2999,14 @@ final class PostboxImpl {
|
||||
|
||||
let startTime = CFAbsoluteTimeGetCurrent()
|
||||
|
||||
var crashDisposable: Disposable?
|
||||
#if DEBUG || BETA
|
||||
crashDisposable = (Signal<Void, NoError>.single(Void())
|
||||
|> delay(0.1, queue: .concurrentDefaultQueue())).startStandalone(next: { _ in
|
||||
preconditionFailure()
|
||||
})
|
||||
#endif
|
||||
|
||||
self.valueBox.begin()
|
||||
let transaction = Transaction(queue: self.queue, postbox: self)
|
||||
self.afterBegin(transaction: transaction)
|
||||
@ -3013,6 +3021,9 @@ final class PostboxImpl {
|
||||
postboxLog("Postbox transaction took \(transactionDuration * 1000.0) ms, from: \(file), on:\(line)")
|
||||
}
|
||||
|
||||
crashDisposable?.dispose()
|
||||
|
||||
|
||||
let _ = self.isInTransaction.swap(false)
|
||||
|
||||
if let currentUpdatedState = self.currentUpdatedState {
|
||||
|
@ -90,14 +90,18 @@ func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId:
|
||||
var items: [RenderedChannelParticipant] = []
|
||||
switch result {
|
||||
case let .channelParticipants(_, participants, chats, users):
|
||||
postboxLog("channel users insertion started, count: \(participants.count)")
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
postboxLog("channel users parsed")
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
postboxLog("channel users postbox updated, started mapping ids")
|
||||
var peers: [PeerId: Peer] = [:]
|
||||
for id in parsedPeers.allIds {
|
||||
if let peer = transaction.getPeer(id) {
|
||||
peers[peer.id] = peer
|
||||
}
|
||||
}
|
||||
postboxLog("channel users finish mapping, started updating participants")
|
||||
|
||||
for participant in CachedChannelParticipants(apiParticipants: participants).participants {
|
||||
if let peer = parsedPeers.get(participant.peerId) {
|
||||
@ -108,6 +112,7 @@ func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId:
|
||||
items.append(RenderedChannelParticipant(participant: participant, peer: peer, peers: peers, presences: renderedPresences))
|
||||
}
|
||||
}
|
||||
postboxLog("channel participants finish updating")
|
||||
case .channelParticipantsNotModified:
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user