Merge pull request #2196 from dreampiggy/fix_prefetcher_recursion_stackoverflow

Fix the issue that prefetcher will cause stack overflow is the input urls list is huge because of recursion function call
This commit is contained in:
DreamPiggy 2018-01-28 19:30:48 +08:00 committed by GitHub
commit a9a123fc74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -80,7 +80,8 @@
];
}
if (self.prefetchURLs.count > self.requestedCount) {
dispatch_queue_async_safe(self.prefetcherQueue, ^{
dispatch_async(self.prefetcherQueue, ^{
// we need dispatch to avoid function recursion call. This can prevent stack overflow even for huge urls list
[self startPrefetchingAtIndex:self.requestedCount];
});
} else if (self.finishedCount == self.requestedCount) {