mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Fix fetch queue parallelization
This commit is contained in:
@@ -748,7 +748,9 @@ public final class AnimationCacheImpl: AnimationCache {
|
|||||||
updateResult(AnimationCacheItemResult(item: nil, isFinal: false))
|
updateResult(AnimationCacheItemResult(item: nil, isFinal: false))
|
||||||
|
|
||||||
if beginFetch {
|
if beginFetch {
|
||||||
guard let writer = AnimationCacheItemWriterImpl(queue: self.fetchQueues[self.nextFetchQueueIndex % self.fetchQueues.count], allocateTempFile: self.allocateTempFile, completion: { [weak self, weak itemContext] result in
|
let fetchQueueIndex = self.nextFetchQueueIndex
|
||||||
|
self.nextFetchQueueIndex += 1
|
||||||
|
guard let writer = AnimationCacheItemWriterImpl(queue: self.fetchQueues[fetchQueueIndex % self.fetchQueues.count], allocateTempFile: self.allocateTempFile, completion: { [weak self, weak itemContext] result in
|
||||||
queue.async {
|
queue.async {
|
||||||
guard let strongSelf = self, let itemContext = itemContext, itemContext === strongSelf.itemContexts[sourceId] else {
|
guard let strongSelf = self, let itemContext = itemContext, itemContext === strongSelf.itemContexts[sourceId] else {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user