node.js http.get hangs after 5 requests to remote site

前端 未结 2 1734
时光说笑
时光说笑 2020-11-29 01:28

I\'m writing a simple api endpoint to determine if my server is able to reach the internet. It works great, but after 5 requests (exactly 5, every time) the request hangs. S

2条回答
  •  执笔经年
    2020-11-29 02:02

    If you wait long enough, the 5 requests will time-out and the next 5 will process so the application isn't really hanging, because it will eventually process through all of the requests.

    To speed up the process you need to do something with the response data such as r.on('data', function() {});

提交回复
热议问题