Skip to content

Commit ea1aa0e

Browse files
cheniumgarrettmoon
authored andcommitted
Add option to skip retry on download error. (#336)
1 parent 941bd66 commit ea1aa0e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Source/Classes/PINRemoteImageManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ typedef NS_OPTIONS(NSUInteger, PINRemoteImageManagerDownloadOptions) {
5757
PINRemoteImageManagerSaveProcessedImageAsJPEG = 1 << 3,
5858
/** Ignore cache and force download */
5959
PINRemoteImageManagerDownloadOptionsIgnoreCache = 1 << 4,
60+
/** Skip download retry */
61+
PINRemoteImageManagerDownloadOptionsSkipRetry = 1 << 5,
6062
};
6163

6264
/**

Source/Classes/PINRemoteImageManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ - (NSURLSessionDataTask *)sessionTaskWithURL:(NSURL *)url
832832
NSUInteger newNumberOfRetries = 0;
833833
[strongSelf lock];
834834
PINRemoteImageDownloadTask *task = [strongSelf.tasks objectForKey:key];
835-
if (task.numberOfRetries < PINRemoteImageMaxRetries) {
835+
if (task.numberOfRetries < PINRemoteImageMaxRetries && (options & PINRemoteImageManagerDownloadOptionsSkipRetry) == NO) {
836836
retry = YES;
837837
newNumberOfRetries = ++task.numberOfRetries;
838838

0 commit comments

Comments
 (0)