[Refactor] Use NSMutableSet for failed URLs' storage instead of array

This commit is contained in:
Syo Ikeda 2015-03-18 12:33:28 +09:00
parent d41bfaf8c8
commit 210c13d124
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];
}
}
}