Fix fetch queue parallelization

This commit is contained in:
Ali 2022-06-24 02:48:30 +01:00
parent 96a410fc14
commit 2e71c1fa5e

View File

@ -748,7 +748,9 @@ public final class AnimationCacheImpl: AnimationCache {
updateResult(AnimationCacheItemResult(item: nil, isFinal: false))
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 {
guard let strongSelf = self, let itemContext = itemContext, itemContext === strongSelf.itemContexts[sourceId] else {
return