pidusage icon indicating copy to clipboard operation
pidusage copied to clipboard

Ton of process open to check pidusage

Open r-rajaneesh opened this issue 2 years ago • 0 comments

API Platform version(s) affected: Windows 10

Description

Running the code in a setInterval causes a ton of process to be create and cause lag

How to reproduce

import pidusage from "pidusage";
setInterval(() => {
  pidusage(process.pid, (error, stats) => {
    console.log(stats.cpu);
  });
}, 1000);

Just run this above code

Possible Solution

Just run one process all the time and check the usage and send the usage back, instead of creating multiple process to check usage.

Additional Context

Cannot provide, causes a lot of lag by creating a ton of processes in a matter of few seconds.

r-rajaneesh avatar Apr 15 '22 14:04 r-rajaneesh