tulios / kafkajs

A modern Apache Kafka client for node.js
https://kafka.js.org
MIT License
3.75k stars 527 forks source link

cswch too high #1604

Closed rambo-panda closed 2 months ago

rambo-panda commented 1 year ago

Describe the bug

image image

Accidentally discovered that using cswch too high in version 2.2.4 (the same problem for consumers). this directly caused the load of my node app to have a CPU utilization rate of 10-20 even during off-peak hours.

Environment:

rambo-panda commented 1 year ago

https://github.com/tulios/kafkajs/blob/c08472878724ce5fc62a9a9aa865255d7e7682a6/src/network/requestQueue/index.js#L314-L316

If this.pending.length is 0, it means that it will fall into the setTmeout dead loop