[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Clear timeout on #abort() #3090

Merged
merged 4 commits into from
Dec 24, 2018
Merged

Clear timeout on #abort() #3090

merged 4 commits into from
Dec 24, 2018

Conversation

reconbot
Copy link
Contributor

This is a rebased version of #2410 with review notes addressed and an additional clearTimeout that either didn't exist or was missed in the original pr.

From @elmigranto's #2410

Calling #abort() does not clear timeout, process hangs until timer is triggered. There are couple of places this is done correctly, #abort() happens not to be one of them. There are couple of relevant issues and PRs from years ago.

Sample script to reproduce:

'use strict';
const request = require('request');
const started = Date.now();
const printTime = label => () => console.log('%d ms\t%s', Date.now() - started, label);

const req = request({
  uri: 'http://example.com',
  timeout: 2500
}, printTime('callback'));

setTimeout(() => {
  req.abort();
  printTime('aborted')();
}, 10);

process.on('exit', printTime('exit'));

// 27 ms    aborted
// 2519 ms  callback
// 2521 ms  exit

Let's close this one finally. Can any of you guys help, please? @mikeal @simov

closes @2410

@reconbot reconbot merged commit df346d8 into master Dec 24, 2018
@reconbot reconbot deleted the elmigranto-master branch December 24, 2018 19:27
@reconbot
Copy link
Contributor Author

Sorry @elmigranto I'm not sure why github didn't give you attribution on the final squash commit. I'll make sure you get called out in the change log.

@elmigranto
Copy link

Hey, no problem. Thanks for getting it in, Francis!

@reconbot

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

Successfully merging this pull request may close these issues.

2 participants