feat(daemon): Add CLI systemd service refresh on version mismatch and fix daemon memory leak; update dependencies

This commit is contained in:
2025-08-30 22:01:19 +00:00
parent e09cf38f30
commit 5e26b0ab5f
8 changed files with 79 additions and 3 deletions

View File

@@ -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();
}
}