Merge pull request #1076 from ikesyo/faild-urls-nsset

[Refactor] Use NSMutableSet for failed URLs' storage instead of array
This commit is contained in:
Bogdan Poplauschi 2015-03-18 11:24:55 +02:00
commit 27e3038ec3
1 changed files with 3 additions and 5 deletions

View File

@ -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];
}
}
}