-
Notifications
You must be signed in to change notification settings - Fork 481
Optional global timeout for http/jsonp calls on server #622
Comments
this is a feature for http but you can also implement it yourself using rxjs. in rxjs you can use Observable.race(
this.http.get(url),
Observable.of(null).delay(2000)
) something like that above will work but if the http call fails it will wait until the delay is done so perhaps write a better version than that. We can put this feature in the universal-starter as an example for the ApiService |
I know I can do this with RxJS, in fact, I'm actually writing a workaround to fix this (overriding NodeBackend and NodeJsonpBackend to add the timeout). The feature request is because when you have a code base with 30+ services and 50+ components, you can't go and add a |
I just wrote this module as a workaround for this issue, in case anyone else finds it useful https://gist.github.com/diestrin/d9320064bf016cfd25210bb0452bb42a |
also you can track this issue for .timeout |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Do you want to request a feature or report a bug?
feature
What is the current behavior?
If an http/jsonp endpoint, for some reason takes too much to respond, it will completely block the server respond.
What is the expected behavior?
There should be a global timeout configuration for server http/jsonp requests.
What is the motivation / use case for changing the behavior?
Delegating long responses to the client. Reduce the number of active clients waiting for a long response in server.
Please tell us about your environment:
I found this code, I think a simple timeout option can be passed there. Node already support passing the timeout value for
http.request
The text was updated successfully, but these errors were encountered: