-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
should not add url to failedURLs when timeout, cancel and so on. #707
Comments
+1 on this, I think I'm being bitten by the same bug. |
+1 as well, or if the author thinks he really needs this feature, maybe make it an optional feature to add those failed URLs with a boolean we could set after initializing the SDWebImageManager |
Backed up my request with some code, as for now on my own projects, after I download via cocoapods I just comment out After working with that code, I realized that the property should be placed in the header file, so hopefully I'll make another pull request shortly |
Ok to not add URL as failed in case of timeout. I will accept a pull request for this. |
I could do that but should I remove the feature or modify the feature to make it optional? |
I think the best way is to set the default option for adding fail url. |
Only permanent errors should be added to failed URLs by default. You may add an option to treat temporary errors like timeout as failures if you want though. |
after doing some research I have a different proposition, how about these different Error codes don't cause the URL to be added to failedURLs as well,
And we just add these to that if statement @Whirlwind has shared above. Then we don't have this weird option and things work as proposed by @Whirlwind |
Why not |
Apple docs say "Returned when an asynchronous load is canceled." so this would occur if the user canceled the SDWebImageOperation right? I agree this shouldn't cause the URL to be added to the failedURLs as well |
Is it like this:
right? |
+1 for including NSURLErrorTimedOut as an error code that doesn't add to failedURLs. I have made this change to my local codebase but would love to see it make its way into the main repo. |
Can anyone create a pull request with this? |
@bpoplauschi the pull request like #766 ? |
should not add url to failedURLs when timeout, cancel and so on. #707
Fixed by #766 |
if (error.code != NSURLErrorNotConnectedToInternet && error.code != NSURLErrorCancelled && error.code != NSURLErrorTimedOut) This failed to detect not connected to internet. I just removed [self.failedURLs addObject:url]; even if it was a broken link. I am getting kCFURLErrorCannotConnectToHost which is -1004. when I am not connected to internet. that should be added (Maybe). I prefer to remove failedURLs for good. |
On iOS > 6, the error codes that don't make it to shouldBeFailedURLAlliOSVersion can still make it to shouldBeFailedURLiOS7 and ruin things still, since the code checks either of them to be YES. |
@bpoplauschi thanks! |
I found I often fail to show image because of some season, but it will not display forever.
I debug it, and I found I got a
NSURLErrorTimedOut
, and there is a code like this:I think I should not add the url to failedURLs if I got a timeout. I think I can retry download to be OK, because the url is ok, and the network is bad.
I think that
NSURLErrorCancelled
,NSURLErrorTimedOut
,NSURLErrorNotConnectedToInternet
should be retry.The text was updated successfully, but these errors were encountered: