feat(daemon): Add CLI systemd service refresh on version mismatch and fix daemon memory leak; update dependencies
This commit is contained in:
@@ -139,6 +139,14 @@ export class ProcessMonitor extends EventEmitter {
|
||||
this.logger.info(exitMsg);
|
||||
this.log(exitMsg);
|
||||
|
||||
// Clear pidusage internal state for this PID to prevent memory leaks
|
||||
try {
|
||||
const pidToClear = this.processWrapper?.getPid();
|
||||
if (pidToClear) {
|
||||
(plugins.pidusage as any)?.clear?.(pidToClear);
|
||||
}
|
||||
} catch {}
|
||||
|
||||
// Flush logs to disk on exit
|
||||
if (this.processId && this.logs.length > 0) {
|
||||
try {
|
||||
@@ -385,6 +393,13 @@ export class ProcessMonitor extends EventEmitter {
|
||||
clearInterval(this.intervalId);
|
||||
}
|
||||
if (this.processWrapper) {
|
||||
// Clear pidusage state for current PID before stopping to avoid leaks
|
||||
try {
|
||||
const pidToClear = this.processWrapper.getPid();
|
||||
if (pidToClear) {
|
||||
(plugins.pidusage as any)?.clear?.(pidToClear);
|
||||
}
|
||||
} catch {}
|
||||
this.processWrapper.stop();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user