mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 23:19:43 +02:00
fix: memory leaks and error handling improvements
- execution-bridge: track and cleanup retry timers to prevent memory leaks - model-selector: add exhaustive type check for ModelTier - ralph-tracker: fix division by zero when summary.total is 0 - respawn-controller: remove event listeners on stop to prevent memory leaks - screen-manager: use Promise.allSettled for better error handling in stats - session-manager: use Promise.allSettled for stopAllSessions resilience Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -191,12 +191,19 @@ export class SessionManager extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Stops all active sessions.
|
||||
* Uses Promise.allSettled to ensure all sessions are stopped even if some fail.
|
||||
*/
|
||||
async stopAllSessions(): Promise<void> {
|
||||
const stopPromises = Array.from(this.sessions.keys()).map((id) =>
|
||||
this.stopSession(id)
|
||||
);
|
||||
await Promise.all(stopPromises);
|
||||
const results = await Promise.allSettled(stopPromises);
|
||||
// Log any failures but don't throw - best effort cleanup
|
||||
for (const result of results) {
|
||||
if (result.status === 'rejected') {
|
||||
console.error('[SessionManager] Failed to stop session:', result.reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user