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:
parent
2052557e83
commit
7e96b776ca
|
@ -80,7 +80,8 @@
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (self.prefetchURLs.count > self.requestedCount) {
|
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];
|
[self startPrefetchingAtIndex:self.requestedCount];
|
||||||
});
|
});
|
||||||
} else if (self.finishedCount == self.requestedCount) {
|
} else if (self.finishedCount == self.requestedCount) {
|
||||||
|
|
Loading…
Reference in New Issue