npm / npm-registry-client

http://npm.im/npm-registry-client
ISC License
264 stars 108 forks source link

Add timeout option (with default) for network requests #128

Closed ganemone closed 6 years ago

ganemone commented 8 years ago

Since the request library does not set a default timeout, any request that hangs will hang indefinitely and cause npm install to hang indefinitely. The request library recommends having a timeout on all requests. This diff adds a timeout option that defaults to 10 seconds, as well as tests surrounding the timeout functionality.

mlmorg commented 8 years ago

This might be related to https://github.com/npm/npm/issues/7862

lxe commented 8 years ago

What about the current .get timeout config parameter?

client.get(uri, params, cb)

...
timeout {Number} Duration before the request times out. Optional (default: never).
zkat commented 6 years ago

I'm closing this because npm-registry-client is no longer used as the fetcher for npm5. pacote and make-fetch-happen should both support a timeout option now, though I can't recall if it's fully threaded through or hard-defaulted on the npm side of things.

Thanks for the contribution! It's been a while now but I'm glad to be dealing with these old PRs :)