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

@@ -1,41 +1,17 @@
import { NextResponse } from 'next/server'
import { automationService } from '../../../../lib/automation-service-simple'
import { emergencyAutomation } from '../../../../lib/emergency-automation'
export async function GET() {
try {
// Get status from the automation service directly (includes timing and individual results)
const status = await automationService.getStatus()
const status = emergencyAutomation.getStatus()
if (!status) {
return NextResponse.json({
success: true,
status: {
isActive: false,
mode: 'SIMULATION',
symbol: 'SOLUSD',
timeframe: '1h',
totalTrades: 0,
successfulTrades: 0,
winRate: 0,
totalPnL: 0,
errorCount: 0,
nextAnalysisIn: 0,
analysisInterval: 3600,
currentCycle: 0,
individualTimeframeResults: []
}
})
}
return NextResponse.json({
return Response.json({
success: true,
status: status
status
})
} catch (error) {
console.error('Automation status error:', error)
return NextResponse.json({
return Response.json({
success: false,
error: 'Failed to get automation status'
error: error.message
}, { status: 500 })
}
}