Merge pull request #1076 from ikesyo/faild-urls-nsset
[Refactor] Use NSMutableSet for failed URLs' storage instead of array
This commit is contained in:
commit
27e3038ec3
|
@ -21,7 +21,7 @@
|
|||
|
||||
@property (strong, nonatomic, readwrite) SDImageCache *imageCache;
|
||||
@property (strong, nonatomic, readwrite) SDWebImageDownloader *imageDownloader;
|
||||
@property (strong, nonatomic) NSMutableArray *failedURLs;
|
||||
@property (strong, nonatomic) NSMutableSet *failedURLs;
|
||||
@property (strong, nonatomic) NSMutableArray *runningOperations;
|
||||
|
||||
@end
|
||||
|
@ -41,7 +41,7 @@
|
|||
if ((self = [super init])) {
|
||||
_imageCache = [self createCache];
|
||||
_imageDownloader = [SDWebImageDownloader sharedDownloader];
|
||||
_failedURLs = [NSMutableArray new];
|
||||
_failedURLs = [NSMutableSet new];
|
||||
_runningOperations = [NSMutableArray new];
|
||||
}
|
||||
return self;
|
||||
|
@ -194,9 +194,7 @@
|
|||
|
||||
if (error.code != NSURLErrorNotConnectedToInternet && error.code != NSURLErrorCancelled && error.code != NSURLErrorTimedOut) {
|
||||
@synchronized (self.failedURLs) {
|
||||
if (![self.failedURLs containsObject:url]) {
|
||||
[self.failedURLs addObject:url];
|
||||
}
|
||||
[self.failedURLs addObject:url];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue