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

Client is submitting the request again by itself after timeout time #174

Open
ranupoju0126 opened this issue Nov 17, 2017 · 0 comments
Open

Comments

@ranupoju0126
Copy link

HI,

below is my code
**var options = {user: config.jobMonitor.user, password: config.jobMonitor.password}
var client = new Client(options);

    var args = {
        data: postData,
        headers: {
            "test-header": "client-api",
            "Content-Type": "application/json"
        },
        requestConfig: {
            timeout: 120000, //request timeout in milliseconds
        },
        responseConfig: {
            timeout: 1000 //response timeout
        }

    }

var req = client.post(config.jobMonitor.uri, args, function (data, response) {
pageResult.currentPage = parseInt(data.currentPageIndex);
pageResult.count = parseInt(data.resultsCount);
pageResult.jobs = data.jobDetails;
pageResult.pages = parseInt(data.numberOfPages);

        if(response.statusCode == 200){
            pageResult.statusCode = response.statusCode;
            self.emit('send-data', pageResult);
        }

    });

    req.on('requestTimeout', function (req) {
        console.log('request has expired');
        self.emit('send-error','timeout')
        req.abort();
    });

    req.on('responseTimeout', function (res) {
        console.log('response has expired');

    });
    req.on('error', function (err) {
        console.log('request error');
    });
}**

after 120 seconds, its not timing out and the client is submitting the request again by itself
image

Please see the above image.... after every 2 mins(120 seconds) there is a log for post data to client.

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