javascript - How to solve trouble by blocking requests for one URI in node.js? -
i want solve problem of blocking requests same uri. using express routing requests.
app.get('/task', function(req, res){ console.log("geted"); settimeout(function(){ res.json({"status":"ok"}); res.end(); },10000); });
if make 2 sequential request uri [localhost / task], second "geted" appears after execution of first request. 10 seconds after first request.
geted /task 200 10016ms - 20b geted /task 200 10005ms - 20b
requests other uri not locked (thanks express), though time, not yet sent 2 identical request.
the question why , how avoid / fix problem?
nodejs v10.26.0 express v3.4.8
this not node problem, caused browser.
if send 2 identical requests in 1 browser instance (say, 2 open tabs in same browser), browser not send second request until first 1 finished.
try opening 2 different browsers, 1 chrome , 1 firefox, , send request once each. i'm betting see behave way expect.
Comments
Post a Comment