fix(processmanager): Improve process lifecycle handling and cleanup in daemon, monitors and wrappers
This commit is contained in:
@@ -450,10 +450,12 @@ export class TspmDaemon {
|
||||
|
||||
await this.tspmInstance.setDesiredStateForAll('stopped');
|
||||
await this.tspmInstance.stopAll();
|
||||
// Yield briefly to allow any pending exit events to settle
|
||||
await new Promise((r) => setTimeout(r, 50));
|
||||
|
||||
// Get status of all processes
|
||||
for (const [id, processInfo] of this.tspmInstance.processInfo) {
|
||||
if (processInfo.status === 'stopped') {
|
||||
// Determine which monitors are no longer running
|
||||
for (const [id, monitor] of this.tspmInstance.processes) {
|
||||
if (!monitor.isRunning()) {
|
||||
stopped.push(id);
|
||||
} else {
|
||||
failed.push({ id, error: 'Failed to stop' });
|
||||
|
Reference in New Issue
Block a user