Open
Description
**When waiting for messages with the UDP dish it consumes a lot of CPU
import { Dish } from 'zeromq/draft';
import { cpuUsage } from 'process';
const group = 'demo';
async function run() {
const dish = new Dish();
dish.join(group);
await dish.bind('udp://127.0.0.1:3000');
console.log('Subscriber connected to port 3000');
// same issue with for await (const [msg, {group}] of dish)
while (true) {
const [message] = await dish.receive();
console.log('received message:', message.toString());
}
}
const startUsage = cpuUsage();
const printUsage = () => {
const usage = cpuUsage(startUsage);
console.log(`CPU Usage: `, usage);
};
setInterval(printUsage, 1000);
run();
Tested on
- OS: Windows, node 20
- ZeroMQ.js version: 6.3.0