Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/Nuke/Tasks/TaskFetchOriginalData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ final class TaskFetchOriginalData: AsyncPipelineTask<(Data, URLResponse?)>, @unc
return
}

if let data = pipeline.cache.cachedData(for: makeSanitizedRequest()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be better done in the TaskLoadData since the returnCacheDataDontLoad would block this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like TaskLoadData only backs loadData calls so I don't think so.

I don't think returnCacheDataDontLoad blocking this is necessarily bad since one could argue returnCacheDataDontLoad should return an exact match in the cache for a given request, not cached original data that still needs to go through processors/thumbnail decoding. I don't feel super strongly about it though.

send(value: (data, nil), isCompleted: true)
}

if let rateLimiter = pipeline.rateLimiter {
// Rate limiter is synchronized on pipeline's queue. Delayed work is
// executed asynchronously also on the same queue.
Expand Down Expand Up @@ -183,7 +187,7 @@ extension AsyncPipelineTask where Value == (Data, URLResponse?) {

/// Returns a request that doesn't contain any information non-related
/// to data loading.
private func makeSanitizedRequest() -> ImageRequest {
fileprivate func makeSanitizedRequest() -> ImageRequest {
var request = request
request.processors = []
request.userInfo[.thumbnailKey] = nil
Expand Down