🔧 Improve cleanup timing correlation with analysis decisions
FIXES: - Enhanced signalAnalysisCycleComplete with more intelligent cleanup logic - Added active session detection to avoid killing processes during analysis - Implemented graceful shutdown (SIGTERM) before force kill (SIGKILL) - Only kills processes older than 2 minutes to avoid disrupting active analysis - Added 10 second delay in runPostCycleCleanup to ensure trading decision is complete - Improved process age filtering to prevent premature cleanup - Cleanup now properly correlates with analysis completion + trading decision - Reduced aggressive kills that were happening during active analysis - Better CPU usage management through smarter process lifecycle - Prevents cleanup from interfering with ongoing analysis work This should significantly reduce the zombie process CPU usage issue by ensuring cleanup only happens when analysis work is truly complete and decisions are finalized.
This commit is contained in:
@@ -210,8 +210,8 @@ export class AutomationService {
|
||||
private async runPostCycleCleanup(reason: string): Promise<void> {
|
||||
console.log(`🧹 Running post-cycle cleanup (reason: ${reason})`)
|
||||
|
||||
// Small delay to ensure all analysis processes have finished
|
||||
await new Promise(resolve => setTimeout(resolve, 2000))
|
||||
// Longer delay to ensure all analysis processes AND trading decision have finished
|
||||
await new Promise(resolve => setTimeout(resolve, 10000)) // 10 seconds
|
||||
|
||||
try {
|
||||
// Signal that the complete analysis cycle is done
|
||||
|
||||
Reference in New Issue
Block a user