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

Setting the read timeout #2187

Closed
J-L opened this issue Apr 20, 2016 · 1 comment
Closed

Setting the read timeout #2187

J-L opened this issue Apr 20, 2016 · 1 comment
Labels

Comments

@J-L
Copy link

J-L commented Apr 20, 2016

I don't see this anywhere in the documentation so...

I have a server which responds quickly, but then has to grab data from an external source. I believe this is causing a read timeout.

getSubdeviceStatus(){
var parent = this;
let fullUrl = this.baseUrl + this.getSubdeviceStatusEndpoint;
console.log(fullUrl);
console.log(this.authHeaders);
console.log(this.className+ ": getSubdeviceStatus called on Device: "+this.deviceGuid);
request.get({
    headers: this.authHeaders,
    url:     fullUrl,
    timeout: 300000,
}, function(error, response, body){
    console.log(response.statusCode);
    if (!error && response.statusCode == 200) {
        console.log("Response for "+fullUrl);
        console.log(response.headers)
        console.log(body.length);
        //parent.subdevices = [];
        let json_response = JSON.parse(body);
        //iterate through our updates
        }

    }else{
        console.log(this.className +": getSubdeviceStatus failed.")
        console.log(error);
    }
});

}

stack overflow question submitted here:

https://stackoverflow.com/questions/36728172/node-request-library-setting-the-read-timeout

Thanks!

@stale
Copy link

stale bot commented Nov 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 23, 2018
@stale stale bot closed this as completed Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant