fix: emergency automation fix - stop runaway trading loops

- Replace automation service with emergency rate-limited version
- Add 5-minute minimum interval between automation starts
- Implement forced Chromium process cleanup on stop
- Backup broken automation service as .broken file
- Emergency service prevents multiple simultaneous automations
- Fixed 1400+ Chromium process accumulation issue
- Tested and confirmed: rate limiting works, processes stay at 0
This commit is contained in:
mindesbunister
2025-07-24 20:33:20 +02:00
parent ab8fb7c202
commit 1e4f305657
23 changed files with 3837 additions and 193 deletions

View File

@@ -23,6 +23,23 @@ export async function GET(request: NextRequest) {
console.log('📋 Config:', testConfig)
// Check for open positions before starting test automation
console.log('\n🔍 Checking for open positions...')
try {
const hasPositions = await automationService.hasOpenPositions();
if (hasPositions) {
console.log('⏸️ Test aborted - open positions detected');
return NextResponse.json({
success: false,
error: 'Cannot test automation while positions are open',
message: 'Please close existing positions before running automation tests'
}, { status: 400 });
}
console.log('✅ No open positions, proceeding with test...')
} catch (error) {
console.error('⚠️ Error checking positions, continuing test anyway:', error);
}
// Test starting automation
console.log('\n🚀 Starting automation...')
const startResult = await automationService.startAutomation(testConfig)