fix(processmonitor): Skip null pidusage entries when aggregating process-group memory/CPU to avoid errors
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tspm',
|
||||
version: '5.10.0',
|
||||
version: '5.10.1',
|
||||
description: 'a no fuzz process manager'
|
||||
}
|
||||
|
@@ -435,8 +435,13 @@ export class ProcessMonitor extends EventEmitter {
|
||||
let totalMemory = 0;
|
||||
let totalCpu = 0;
|
||||
for (const key in stats) {
|
||||
totalMemory += stats[key].memory;
|
||||
totalCpu += Number.isFinite(stats[key].cpu) ? stats[key].cpu : 0;
|
||||
// Check if stats[key] exists and is not null (process may have exited)
|
||||
if (stats[key]) {
|
||||
totalMemory += stats[key].memory || 0;
|
||||
totalCpu += Number.isFinite(stats[key].cpu) ? stats[key].cpu : 0;
|
||||
} else {
|
||||
this.logger.debug(`Process ${key} stats are null (process may have exited)`);
|
||||
}
|
||||
}
|
||||
|
||||
this.logger.debug(
|
||||
|
Reference in New Issue
Block a user