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

timeout option not working #50

Closed
RavenHursT opened this issue Jul 14, 2015 · 1 comment
Closed

timeout option not working #50

RavenHursT opened this issue Jul 14, 2015 · 1 comment

Comments

@RavenHursT
Copy link

So I set up the following:

var rp = require('request-promise');

var start = Date.now();
var reqPromise = rp({
    method: 'get',
    uri: 'http://localhost:8080/test-connection-length',
    timeout: 600000, // 10 min.
    resolveWithFullResponse: true
});

var interval = setInterval(function(){
    console.log('Waiting: ', (Date.now() - start) / 1000);
}, 1000);

reqPromise.then(function(resp){
    console.log('got response: ', resp);
})
.catch(function(err){
    console.error(err.toString());
    console.error(err.stack);
})
.finally(function(){
        console.log('Done: ', (Date.now() - start) / 1000);
    clearInterval(interval);
});

The test server endpoint just sits and doesn't respond, writing a similar console log every second as well.

Even though I have a 10min timeout set, the result is the following in the client:

Waiting:  116.464
Waiting:  117.469
Waiting:  118.475
RequestError: Error: socket hang up
RequestError: Error: socket hang up
Waiting:  119.481
    at new RequestError (/Users/matthewmarcus/WebStormProjects/CaptoraInc/capture-site-validation/node_modules/request-promise/lib/errors.js:11:15)
Done:  120.03
    at Request.RP$callback [as _callback] (/Users/matthewmarcus/WebStormProjects/CaptoraInc/capture-site-validation/node_modules/request-promise/lib/rp.js:50:34)
    at self.callback (/Users/matthewmarcus/WebStormProjects/CaptoraInc/capture-site-validation/node_modules/request-promise/node_modules/request/request.js:197:22)
    at Request.emit (events.js:107:17)
    at Request.onRequestError (/Users/matthewmarcus/WebStormProjects/CaptoraInc/capture-site-validation/node_modules/request-promise/node_modules/request/request.js:854:8)
    at ClientRequest.emit (events.js:107:17)
    at Socket.socketOnEnd (_http_client.js:300:9)
    at Socket.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickCallback (node.js:355:11)

Process finished with exit code 0

Shouldn't this happen at 10mins, not 2?

@RavenHursT
Copy link
Author

Turns out this is a request project issue.

I've opened the same ticket there: request/request#1676

Closing.

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

No branches or pull requests

1 participant