mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 23:19:43 +02:00
perf: optimize for long-running Claude sessions
Critical fixes (unbounded growth): - Add 64KB line buffer limit with 100ms periodic flush in session.ts - Add task tracker cleanup (max 100 completed tasks) - Add scheduled runs auto-cleanup after 1 hour - Fix session leaks in scheduled run iterations High priority (performance): - Add SSE event batching (50ms output, 100ms task updates) - Parallelize screen stats with Promise.all() - Add 1MB buffer limit to respawn controller Medium priority (frontend): - Make xterm scrollback configurable (default 5000) - Debounce renderSessionTabs() at 100ms New feature: - Add CPU and memory usage display in frontend header - New /api/system/stats endpoint Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+10
-7
@@ -228,16 +228,19 @@ export class ScreenManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// Get all screens with stats
|
||||
// Get all screens with stats (parallel for better performance)
|
||||
async getScreensWithStats(): Promise<ScreenSessionWithStats[]> {
|
||||
const result: ScreenSessionWithStats[] = [];
|
||||
const screens = Array.from(this.screens.values());
|
||||
|
||||
for (const screen of this.screens.values()) {
|
||||
const stats = await this.getProcessStats(screen.sessionId);
|
||||
result.push({ ...screen, stats: stats || undefined });
|
||||
}
|
||||
// Fetch all stats in parallel
|
||||
const statsPromises = screens.map(screen => this.getProcessStats(screen.sessionId));
|
||||
const allStats = await Promise.all(statsPromises);
|
||||
|
||||
return result;
|
||||
// Combine screens with their stats
|
||||
return screens.map((screen, i) => ({
|
||||
...screen,
|
||||
stats: allStats[i] || undefined
|
||||
}));
|
||||
}
|
||||
|
||||
// Start periodic stats collection
|
||||
|
||||
Reference in New Issue
Block a user