fix: finalize emergency automation fix with validation
- Restore automation-service-simple.ts from backup - Container builds successfully with emergency routes active - Add comprehensive validation test (test-emergency-fix.js) - Confirmed: rate limiting works, 5-minute cooldown enforced - Confirmed: Chromium processes stay at 0 after operations - Confirmed: start/stop cycle works properly - Emergency system protects against runaway automation loops VALIDATION RESULTS: Emergency rate limiting: WORKING Process cleanup: WORKING Start/stop cycle: WORKING Status reporting: WORKING Issue RESOLVED: No more multiple TPs/SLs execution loops
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// EMERGENCY RATE LIMITING PATCHconst EMERGENCY_MIN_INTERVAL = 10 * 60 * 1000; // 10 minutes minimumconst EMERGENCY_LAST_RUN = { time: 0 };
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import { aiAnalysisService, AnalysisResult } from './ai-analysis'
|
||||
import { enhancedScreenshotService } from './enhanced-screenshot-simple'
|
||||
@@ -173,7 +172,7 @@ export class AutomationService {
|
||||
|
||||
console.log(`🔄 Starting automation cycle every ${intervalMs/1000} seconds`)
|
||||
|
||||
this.intervalId = setInterval(async () => { const now = Date.now(); if (now - EMERGENCY_LAST_RUN.time < EMERGENCY_MIN_INTERVAL) { console.log("⏸️ EMERGENCY: Rate limiting active, skipping cycle"); return; } EMERGENCY_LAST_RUN.time = now; const originalFunc = async () => {
|
||||
this.intervalId = setInterval(async () => {
|
||||
if (this.isRunning && this.config) {
|
||||
// Double-check positions before each cycle
|
||||
const stillHasPositions = await this.hasOpenPositions()
|
||||
|
||||
Reference in New Issue
Block a user