forked from shadowfacts/Tusker
Fix ImageCache kicking off extra requests when a completion block was
not provided
This commit is contained in:
parent
04a6fe807e
commit
de67327f6d
@ -42,13 +42,18 @@ class ImageCache {
|
||||
// of the state (unknown/exists/does not exist) of whether or not objects exist on disk so that the slow, disk I/O
|
||||
// path can be avoided most of the time
|
||||
let entry = try? cache.get(key) {
|
||||
backgroundQueue.async {
|
||||
completion?(entry.data, entry.image)
|
||||
if let completion = completion {
|
||||
backgroundQueue.async {
|
||||
completion(entry.data, entry.image)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
if let completion = completion, let group = groups[url] {
|
||||
return group.addCallback(completion)
|
||||
if let group = groups[url] {
|
||||
if let completion = completion {
|
||||
return group.addCallback(completion)
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
let group = RequestGroup(url: url) { (data, image) in
|
||||
if let data = data {
|
||||
|
Loading…
x
Reference in New Issue
Block a user