Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

config({timeout:5000}) not work #368

Open
denghejun opened this issue May 21, 2017 · 4 comments
Open

config({timeout:5000}) not work #368

denghejun opened this issue May 21, 2017 · 4 comments

Comments

@denghejun
Copy link

denghejun commented May 21, 2017

Hi I found the timeout configuration not work for me:

config({timeout:5000}).fetch('GET','some_uri')

@dmdevoss
Copy link

On iOS:
I know I'm late to the party, but the issue is still open so I'll give my solution.
TLDR: The timeout configuration is only honored if you also assign followRedirect to false.

The best I can tell, the NSURLSessionConfiguration backgroundSessionConfiguration doesn't even look at timeoutIntervalForRequest which is what is being set by this package when you edit the config object. It's suppose to instead look at timeoutIntervalForResource, however, the default for that is 7 days according to apple, which is either false, or my default is being overwritten by another source (not this package). I have tried manually setting it, but it didn't take. I'm a little out of my element looking at objective-c so I'm going to just stick with my solution for now. By setting followRedirect to false, this package uses the defaultSessionConfiguration rather than the background one. Obviously this solution wont work for everyone since there are other things that setting followRedirect to false does.

@wkh237
Copy link
Owner

wkh237 commented Jun 26, 2017

@dmdevoss , thank you for the great explanation 👍 Will try to fix this bug, and of course, a PR is always welcomed !

wkh237 added a commit that referenced this issue Jun 26, 2017
…to defaultSessionConfiguration, and make backgroundSessionConfigurationWithIdentifier optional
@binbinla
Copy link

hello,I found that timeout did not work on android too . Is that an existing problem?

@binbinla
Copy link

Here is what I set : config({timeout:15000}), but when I tested on the device, the timeout notification appeared after 30000, it's double than what I actually want.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants