This is a migrated thread and some comments may be shown as answers.

http module timeout

3 Answers 146 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ian
Top achievements
Rank 1
Ian asked on 12 May 2015, 05:07 PM

Hi. There seems to be a default timeout of 60 seconds when issuing an http.request. The NS documentation seems to suggest you can change this period using HttpRequestOptions. If I want to change the timeout to, say, 5 seconds how should I do it?

I tried using the syntax below (using both 5 and 5000) and it doesn't seem to make any difference (at least not on iOS, I haven't tried Android).

 

http.request({url: "http://myUrl", timeout: 5, method: "GET"}).then(function (r) {
...
}

Am I doing something wrong?

Regards, Ian

 

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 13 May 2015, 06:33 AM
Hi Ian,

We do set the timeout from the options - you can check it here:
https://github.com/NativeScript/NativeScript/blob/master/http/http-request.ios.ts#L36

Regards,
Vlad
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ian
Top achievements
Rank 1
answered on 13 May 2015, 07:33 AM

Hi Vlad,

I did see the code in the http-request.ios.js file which suggests that the timeout period should be specified in whole seconds (and not milliseconds) - is that correct?

If so, should the following http request definitely timeout after 5 seconds?
    http.request({ url: "myUrl", timeout: 5, method: "GET" })...

Adding timeout:5 clearly has some effect as the request no longer times out after 60 seconds but instead it now appears to wait indefinetly. Something's not right.

Regards, Ian

0
Accepted
Vlad
Telerik team
answered on 14 May 2015, 10:24 AM
Hi Ian,

You are right! The iOS timeout logic is definitely wrong (the correct value should be in milliseconds) and we immediately fixed this!

Sorry once again for the confusion!

Regards,
Vlad
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ian
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ian
Top achievements
Rank 1
Share this question
or