Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to detect connect timeouts
It's valuable to be able to detect whether a timeout occurred on the `connect` syscall or on the `write`/`read` syscall of an HTTP request - the former implies that your client can't reach the server and the latter implies the server might not have responded. For backwards compatibility, and standardization with Unix errno codes, the `code` property of connect timeout errors must remain as 'ETIMEDOUT'. Instead of changing this value, add a new `connect` property on timeout errors, which is set to true if the error occurred on the `connect` attempt. Clients have to opt in to checking it - in the common read timeout case, it will be set to `false`. Updates the documentation around each timeout to clarify what is going on, and what situations can trigger each timeout. Updates the README with more accurate documentation about timeout times in the wild. I tried `time curl http://10.255.255.1` and `time curl http://google.com:81` on four different Linux machines (Heroku, boot2docker, Centos on DigitalOcean, a VPS) and the timeout times ranged from 60 seconds to 120 seconds, much longer than the 20 seconds previously suggested. Updates the README with information on how to detect connection timeout failures.
- Loading branch information
1 parent
7a42a98
commit 08bc390
Showing
4 changed files
with
114 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
0 info it worked if it ends with ok | ||
1 verbose cli [ 'node', '/opt/boxen/homebrew/bin/npm', 'run', 'test-cov' ] | ||
2 info using npm@2.13.3 | ||
3 info using node@v0.12.7 | ||
4 verbose node symlink /opt/boxen/homebrew/bin/node | ||
5 verbose run-script [ 'pretest-cov', 'test-cov', 'posttest-cov' ] | ||
6 info pretest-cov request@2.60.1 | ||
7 info test-cov request@2.60.1 | ||
8 verbose unsafe-perm in lifecycle true | ||
9 info request@2.60.1 Failed to exec test-cov script | ||
10 verbose stack Error: request@2.60.1 test-cov: `istanbul cover tape tests/test-*.js` | ||
10 verbose stack Exit status 1 | ||
10 verbose stack at EventEmitter.<anonymous> (/opt/boxen/homebrew/lib/node_modules/npm/lib/utils/lifecycle.js:214:16) | ||
10 verbose stack at EventEmitter.emit (events.js:110:17) | ||
10 verbose stack at ChildProcess.<anonymous> (/opt/boxen/homebrew/lib/node_modules/npm/lib/utils/spawn.js:24:14) | ||
10 verbose stack at ChildProcess.emit (events.js:110:17) | ||
10 verbose stack at maybeClose (child_process.js:1015:16) | ||
10 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5) | ||
11 verbose pkgid request@2.60.1 | ||
12 verbose cwd /Users/burke/code/request | ||
13 error Darwin 14.4.0 | ||
14 error argv "node" "/opt/boxen/homebrew/bin/npm" "run" "test-cov" | ||
15 error node v0.12.7 | ||
16 error npm v2.13.3 | ||
17 error code ELIFECYCLE | ||
18 error request@2.60.1 test-cov: `istanbul cover tape tests/test-*.js` | ||
18 error Exit status 1 | ||
19 error Failed at the request@2.60.1 test-cov script 'istanbul cover tape tests/test-*.js'. | ||
19 error This is most likely a problem with the request package, | ||
19 error not with npm itself. | ||
19 error Tell the author that this fails on your system: | ||
19 error istanbul cover tape tests/test-*.js | ||
19 error You can get their info via: | ||
19 error npm owner ls request | ||
19 error There is likely additional logging output above. | ||
20 verbose exit [ 1, true ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters