0
요청 npm 모듈을 사용 중이며 주류 요청 내에서 4 요청을하고 있습니다. 결론을 먼저 말하면 네 건 중 두 건만 무작위로 성공합니다.요청 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-
});
});
응답의 모든 요청은 무작위로 다르고 4 개의 하위 요청 중 2 개를 선택합니다. 이것의 이유와 그것을 피하는 방법이 무엇일 수 있습니다.