Skip to content
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

Decorate resolve and reject to clear timeout in all cases #1040

Merged
merged 1 commit into from
Mar 8, 2018
Merged

Decorate resolve and reject to clear timeout in all cases #1040

merged 1 commit into from
Mar 8, 2018

Conversation

pbarbiero
Copy link
Contributor

Changing from manually placed calls to clear the timeout timer, to decorating the resolve/reject promise functions instead.

Fixes #1004, #459
Replaces #487

var timer;
var resolve = function resolve(value) {
clearTimeout(timer);
timer = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it was in the original code but you don't need to set timer = null.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it isn't necessary but could you also remove the && !timer from the condition below? I think it never applies because the timer is only set inside the if.

@rubennorte
Copy link
Member

Could you also remove the && !timer condition from the if? It's only set inside it.

@pbarbiero
Copy link
Contributor Author

@rubennorte waiting on anything else from me at this point?

@rubennorte
Copy link
Member

@pbarbiero travis isn't working for this specific PR and I'm not sure why. Once I figure it out I'll merge this, but the code looks good to me.

@igorsechyn
Copy link

This has been an issue for me as well. In my case, I am using axios to make requests from a cli to an external server. If that server is down, i.e. there is no response but ECONNREFUSED error instead, the cli will not exit until the timeout is expired. Would be awesome, if this could be merged.

@datfinesoul
Copy link

Any chance this will be released in the near future? I believe it will fix a few timeout issues I've run into, when the request errors.

@pbarbiero
Copy link
Contributor Author

Politely pinging @nickuraltsev & @rubennorte for a follow up

@TinOo512
Copy link

Any news on that? Having the same issue

@pbarbiero
Copy link
Contributor Author

@emilyemorehouse I hate to bother you, but any chance you can get us moving forward on this one?

@emilyemorehouse
Copy link
Member

@pbarbiero no worries!

I've got a work deadline tomorrow morning, but I'll make sure it gets merged this week. I'll also get it included in the next release. 👍

@emilyemorehouse emilyemorehouse self-assigned this Feb 21, 2018
@emilyemorehouse emilyemorehouse added this to In progress in 0.19.0 Feb 21, 2018
@nickuraltsev nickuraltsev merged commit 4fbf084 into axios:master Mar 8, 2018
0.19.0 automation moved this from In progress to Done Mar 8, 2018
@nickuraltsev
Copy link
Member

@pbarbiero Thank you for the fix!

@pbarbiero pbarbiero deleted the pbarbiero/improved-timeout-handling branch March 8, 2018 17:37
@PhilSwift7 PhilSwift7 mentioned this pull request Oct 5, 2018
@axios axios locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
0.19.0
  
Done
Development

Successfully merging this pull request may close these issues.

Axios waits for timeout (when configured) even if nock throws an error
7 participants