Error: connect ETIMEDOUT at TCPConnectWrap.afterConnect [as oncomplete]
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to call REST API asynchronously in a for loop using XMLHttpRequest module. I'm making 400 requests in 1 loop, with a wait time of 1 sec after every 100 requests. This works fine on clientside javascript. However, when I run on NodeJS using the same module (it's not natively available, I had to download from npmjs) , I'm getting this error after about 230 requests. Any idea if there is another module that I can use to better handle this bulk API requests?
Error: connect ETIMEDOUT at TCPConnectWrap.afterConnect [as oncomplete]
node.js rest api
add a comment |
I'm trying to call REST API asynchronously in a for loop using XMLHttpRequest module. I'm making 400 requests in 1 loop, with a wait time of 1 sec after every 100 requests. This works fine on clientside javascript. However, when I run on NodeJS using the same module (it's not natively available, I had to download from npmjs) , I'm getting this error after about 230 requests. Any idea if there is another module that I can use to better handle this bulk API requests?
Error: connect ETIMEDOUT at TCPConnectWrap.afterConnect [as oncomplete]
node.js rest api
github.com/Microsoft/BotBuilder/issues/4419
– Sayed Mohd Ali
Nov 16 '18 at 14:36
I used the keepaliveavent mentioned in this blog but still get this error. Strange how this works on client side and not on server side. May be I should use different module instead of XMLHttprequest.
– Karthik D
Nov 16 '18 at 15:48
The module where its timing out is (net.js:1161:14). Complete error is shown below: Error: connect ETIMEDOUT 15.125.324.173:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
– Karthik D
Nov 18 '18 at 9:45
add a comment |
I'm trying to call REST API asynchronously in a for loop using XMLHttpRequest module. I'm making 400 requests in 1 loop, with a wait time of 1 sec after every 100 requests. This works fine on clientside javascript. However, when I run on NodeJS using the same module (it's not natively available, I had to download from npmjs) , I'm getting this error after about 230 requests. Any idea if there is another module that I can use to better handle this bulk API requests?
Error: connect ETIMEDOUT at TCPConnectWrap.afterConnect [as oncomplete]
node.js rest api
I'm trying to call REST API asynchronously in a for loop using XMLHttpRequest module. I'm making 400 requests in 1 loop, with a wait time of 1 sec after every 100 requests. This works fine on clientside javascript. However, when I run on NodeJS using the same module (it's not natively available, I had to download from npmjs) , I'm getting this error after about 230 requests. Any idea if there is another module that I can use to better handle this bulk API requests?
Error: connect ETIMEDOUT at TCPConnectWrap.afterConnect [as oncomplete]
node.js rest api
node.js rest api
edited Nov 16 '18 at 18:47
Sayed Mohd Ali
1,5202520
1,5202520
asked Nov 16 '18 at 14:31
Karthik DKarthik D
163
163
github.com/Microsoft/BotBuilder/issues/4419
– Sayed Mohd Ali
Nov 16 '18 at 14:36
I used the keepaliveavent mentioned in this blog but still get this error. Strange how this works on client side and not on server side. May be I should use different module instead of XMLHttprequest.
– Karthik D
Nov 16 '18 at 15:48
The module where its timing out is (net.js:1161:14). Complete error is shown below: Error: connect ETIMEDOUT 15.125.324.173:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
– Karthik D
Nov 18 '18 at 9:45
add a comment |
github.com/Microsoft/BotBuilder/issues/4419
– Sayed Mohd Ali
Nov 16 '18 at 14:36
I used the keepaliveavent mentioned in this blog but still get this error. Strange how this works on client side and not on server side. May be I should use different module instead of XMLHttprequest.
– Karthik D
Nov 16 '18 at 15:48
The module where its timing out is (net.js:1161:14). Complete error is shown below: Error: connect ETIMEDOUT 15.125.324.173:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
– Karthik D
Nov 18 '18 at 9:45
github.com/Microsoft/BotBuilder/issues/4419
– Sayed Mohd Ali
Nov 16 '18 at 14:36
github.com/Microsoft/BotBuilder/issues/4419
– Sayed Mohd Ali
Nov 16 '18 at 14:36
I used the keepaliveavent mentioned in this blog but still get this error. Strange how this works on client side and not on server side. May be I should use different module instead of XMLHttprequest.
– Karthik D
Nov 16 '18 at 15:48
I used the keepaliveavent mentioned in this blog but still get this error. Strange how this works on client side and not on server side. May be I should use different module instead of XMLHttprequest.
– Karthik D
Nov 16 '18 at 15:48
The module where its timing out is (net.js:1161:14). Complete error is shown below: Error: connect ETIMEDOUT 15.125.324.173:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
– Karthik D
Nov 18 '18 at 9:45
The module where its timing out is (net.js:1161:14). Complete error is shown below: Error: connect ETIMEDOUT 15.125.324.173:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
– Karthik D
Nov 18 '18 at 9:45
add a comment |
1 Answer
1
active
oldest
votes
I finally found the solution to my problem.
When using request module for calling REST APIs , you need to specify pool variable in the options. This serves as maxsockets, which is a declaration for concurrent request processing.
Sample code is posted below for those who run unto this issue:
For more info, check out below post:
How to use Request js (Node js Module) pools
var separateReqPool = maxSockets: 20;
var request = require('request');
var url_array = ['url1','url2','url3'];//Array of all the urls to call
async.map(url_array, function(item, callback)
request(url: item, pool: separateReqPool, function (error, response, body)
//Do Something with the response
);
, function(err, results)
console.log(results);
);
}).
catch((err) =>
console.log(err);
);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339823%2ferror-connect-etimedout-at-tcpconnectwrap-afterconnect-as-oncomplete%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I finally found the solution to my problem.
When using request module for calling REST APIs , you need to specify pool variable in the options. This serves as maxsockets, which is a declaration for concurrent request processing.
Sample code is posted below for those who run unto this issue:
For more info, check out below post:
How to use Request js (Node js Module) pools
var separateReqPool = maxSockets: 20;
var request = require('request');
var url_array = ['url1','url2','url3'];//Array of all the urls to call
async.map(url_array, function(item, callback)
request(url: item, pool: separateReqPool, function (error, response, body)
//Do Something with the response
);
, function(err, results)
console.log(results);
);
}).
catch((err) =>
console.log(err);
);
add a comment |
I finally found the solution to my problem.
When using request module for calling REST APIs , you need to specify pool variable in the options. This serves as maxsockets, which is a declaration for concurrent request processing.
Sample code is posted below for those who run unto this issue:
For more info, check out below post:
How to use Request js (Node js Module) pools
var separateReqPool = maxSockets: 20;
var request = require('request');
var url_array = ['url1','url2','url3'];//Array of all the urls to call
async.map(url_array, function(item, callback)
request(url: item, pool: separateReqPool, function (error, response, body)
//Do Something with the response
);
, function(err, results)
console.log(results);
);
}).
catch((err) =>
console.log(err);
);
add a comment |
I finally found the solution to my problem.
When using request module for calling REST APIs , you need to specify pool variable in the options. This serves as maxsockets, which is a declaration for concurrent request processing.
Sample code is posted below for those who run unto this issue:
For more info, check out below post:
How to use Request js (Node js Module) pools
var separateReqPool = maxSockets: 20;
var request = require('request');
var url_array = ['url1','url2','url3'];//Array of all the urls to call
async.map(url_array, function(item, callback)
request(url: item, pool: separateReqPool, function (error, response, body)
//Do Something with the response
);
, function(err, results)
console.log(results);
);
}).
catch((err) =>
console.log(err);
);
I finally found the solution to my problem.
When using request module for calling REST APIs , you need to specify pool variable in the options. This serves as maxsockets, which is a declaration for concurrent request processing.
Sample code is posted below for those who run unto this issue:
For more info, check out below post:
How to use Request js (Node js Module) pools
var separateReqPool = maxSockets: 20;
var request = require('request');
var url_array = ['url1','url2','url3'];//Array of all the urls to call
async.map(url_array, function(item, callback)
request(url: item, pool: separateReqPool, function (error, response, body)
//Do Something with the response
);
, function(err, results)
console.log(results);
);
}).
catch((err) =>
console.log(err);
);
var separateReqPool = maxSockets: 20;
var request = require('request');
var url_array = ['url1','url2','url3'];//Array of all the urls to call
async.map(url_array, function(item, callback)
request(url: item, pool: separateReqPool, function (error, response, body)
//Do Something with the response
);
, function(err, results)
console.log(results);
);
}).
catch((err) =>
console.log(err);
);
var separateReqPool = maxSockets: 20;
var request = require('request');
var url_array = ['url1','url2','url3'];//Array of all the urls to call
async.map(url_array, function(item, callback)
request(url: item, pool: separateReqPool, function (error, response, body)
//Do Something with the response
);
, function(err, results)
console.log(results);
);
}).
catch((err) =>
console.log(err);
);
answered Nov 18 '18 at 15:36
Karthik DKarthik D
163
163
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339823%2ferror-connect-etimedout-at-tcpconnectwrap-afterconnect-as-oncomplete%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
github.com/Microsoft/BotBuilder/issues/4419
– Sayed Mohd Ali
Nov 16 '18 at 14:36
I used the keepaliveavent mentioned in this blog but still get this error. Strange how this works on client side and not on server side. May be I should use different module instead of XMLHttprequest.
– Karthik D
Nov 16 '18 at 15:48
The module where its timing out is (net.js:1161:14). Complete error is shown below: Error: connect ETIMEDOUT 15.125.324.173:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
– Karthik D
Nov 18 '18 at 9:45