Hi, when i logout my account with many chat inside, chromium process take high CPU and memory consumption, but when using account with less chat inside. the process is normal.
here my code and screenshot of task manager, thanks
const { Client } = require('whatsapp-web.js');
const client = new Client({
puppeteer: {
headless: false,
}
});
client.on('qr', (qr) => {
// Generate and scan this code with your phone
console.log('QR RECEIVED', qr);
});
client.on('ready', () => {
console.log('Client is ready!');
});
client.on('message', msg => {
if (msg.body == '!ping') {
msg.reply('pong');
}
});
client.on('disconnect', reason => {
console.log(reason)
});
client.initialize();

@pedroslopez after made some research this is because window.Store.Msg.on('remove', window.onRemoveMessageEvent); listener i removed this line and try logout with my device with lots of chat, now the CPU usage seem normal.
any idea with this?
Okay, apparently all these event handlers need to be delegated first and not go straight through to a puppeteer function. After yesterday's fix, I saw a lot of improvement in performance and CPU usage when receiving messages and specially on startup. I'll make the fix later today to do this with all event handlers.
Thanks for reporting and the input! @tarikhagustia @Aliyss
For reference, here is the difference I saw before and after yesterday's fix, and the amount of messages coming in has increased as well.

Wooow! Amazing improvement, i have been tracking this behaviour of high CPU usage but no success, i waiting your PR to test and will post my graphs of performance! I have 17Instances running that code LoL @pedroslopez
That's my actual performance,
Pay attention to high decrease every midnight, i manually proceed restarts on all instances at that time.

@joaomirandasa please note that most of the improvements seen with the fix was with CPU usage and not with memory. The utilized memory by chrome still grows steadily over time, unfortunately.
v1.2.3 has now been released. Please check and report your findings @tarikhagustia @joaomirandasa
using latest version fix this issue, thanks for a great job, i'll close this issue
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.