Using stream as input to an async queue in Node.js, how to make sure that queue.drain is called only once
问题 I will be reading a series of inputs from a stream, and perform a HTTP GET request per input. To avoid creating too many connections at a time, I am using async.queue to queue up these inputs. After all inputs are read ( end emitted to the stream), I would like to collect previous results and generate an overview. I am currently using queue.drain for this purpose. But queue.drain may be called multiple times in my case, since the process could be blocked on input and the queue will be empty