-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
timeouts #17
Comments
I might use superagent for a mobile project, so I need interrupts to deal with shoddy mobile networks. Experimented a bit over the weekend. I have some working code in my fork that works like this: request('GET', '/slow')
.interruptAfter("1.5s")
.end(function(res){
if (req.interrupted) { do stuff and return }
else { whatever }
}) There's also a interruptEvery. The time argument can be a number of millis or a string of the form "300ms" or "1.5s". Any opinons. Not entirely sure about the API. I'd be happy to fix up my branch and submit pull request if we could come up with a reasonable API. |
I would definitely prefer |
As an alternative to .interruptAfter presumably? I kinda hate the term "timeout" as it's so generic, but in this context it makes sense I suppose. Would align with the naming of window.setTimeout. How about interruptEvery is it needed? Could rename to .interval(ms), which soulds a bit weird, but would work. |
And what is default timeout for requesr? Can't find this info! |
I also can't find it. I want to create a longer timeout for a particular request. |
By default there is no timeout (superagent will wait for the response forever). You set timeout with |
Okay, thanks. That's good to know. |
No description provided.
The text was updated successfully, but these errors were encountered: