Skip to content

Commit

Permalink
Add option to skip retry on download error.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenium committed Mar 21, 2017
1 parent 79089b0 commit cef5e51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Source/Classes/PINRemoteImageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ typedef NS_OPTIONS(NSUInteger, PINRemoteImageManagerDownloadOptions) {
PINRemoteImageManagerSaveProcessedImageAsJPEG = 1 << 3,
/** Ignore cache and force download */
PINRemoteImageManagerDownloadOptionsIgnoreCache = 1 << 4,
/** Skip download retry */
PINRemoteImageManagerDownloadOptionsSkipRetry = 1 << 5,
};

/**
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/PINRemoteImageManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ - (NSURLSessionDataTask *)sessionTaskWithURL:(NSURL *)url
NSUInteger newNumberOfRetries = 0;
[strongSelf lock];
PINRemoteImageDownloadTask *task = [strongSelf.tasks objectForKey:key];
if (task.numberOfRetries < PINRemoteImageMaxRetries) {
if (task.numberOfRetries < PINRemoteImageMaxRetries && (options & PINRemoteImageManagerDownloadOptionsSkipRetry) == NO) {
retry = YES;
newNumberOfRetries = ++task.numberOfRetries;

Expand Down

0 comments on commit cef5e51

Please sign in to comment.