0
リクエストnpmモジュールを使用しており、メインストリームリクエストの中で4リクエストを行っています。結論を最初に言うには、4つの要求のうち2つだけがランダムに成功する。リクエストnpmモジュール - リクエストの中でリクエストする
以下は私のコードです。
router.get('/', function(req, res){
//TODO
request(url, function(error, response, body) {
if(err) throw error;
//TODO-
request(comnURL, function(errp,resp, body){
if(errp) throw errp;
comnBODY = body;
console.log(body);
console.log("\n\n");
});
request(intrURL, function(errp,resp, body){
if(errp) throw errp;
intrBODY = body;
console.log(body);
console.log("\n\n");
});
request(reptURL, function(errp,resp, body){
if(errp) throw errp;
reptBODY = body;
console.log(body);
console.log("\n\n");
});
request(addiURL, function(errp,resp, body){
if(errp) throw errp;
addiBODY = body;
console.log(body);
console.log("\n\n");
});
//TODO-
});
});
すべての応答要求はランダムに異なり、2つのサブ要求のうちの2つを選択します。これの理由とその回避方法を教えてください。