Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test: Fix premature close in test-http-client-timeout-agent

  • Loading branch information...
commit ea2ceb731ca7dc6f2a11e501894adabf1cb4d20a 1 parent 411d460
@isaacs isaacs authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 test/simple/test-http-client-timeout-agent.js
View
13 test/simple/test-http-client-timeout-agent.js
@@ -78,9 +78,16 @@ server.listen(options.port, options.host, function() {
});
req.end();
}
- setTimeout(function() {
- server.close();
- }, 150);
+
+ setTimeout(function maybeDone() {
+ if (requests_done >= requests_sent) {
+ setTimeout(function() {
+ server.close();
+ }, 100);
+ } else {
+ setTimeout(maybeDone, 100);
+ }
+ }, 100);
});
process.on('exit', function() {
Please sign in to comment.
Something went wrong with that request. Please try again.