Skip to content

Commit

Permalink
Fixed issue where dequeued request was dropped when task was still nil (
Browse files Browse the repository at this point in the history
  • Loading branch information
cnoon authored Aug 27, 2019
1 parent c41f8b0 commit 7f4bc4a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/ImageDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,10 @@ open class ImageDownloader {
synchronizationQueue.sync {
guard self.isActiveRequestCountBelowMaximumLimit() else { return }

let states: Set<Request.State> = [.initialized, .suspended]

while !self.queuedRequests.isEmpty {
if let request = self.dequeue(), request.task?.state == .suspended {
if let request = self.dequeue(), states.contains(request.state) {
self.start(request)
break
}
Expand Down

0 comments on commit 7f4bc4a

Please # to comment.