- 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
26 lines
713 B
JavaScript
26 lines
713 B
JavaScript
import { emergencyAutomation } from '@/lib/emergency-automation'
|
|
|
|
export async function POST() {
|
|
try {
|
|
console.log('🚨 EMERGENCY: Stop request received')
|
|
|
|
const result = await emergencyAutomation.stop()
|
|
|
|
// Also force kill any remaining processes
|
|
try {
|
|
const { execSync } = require('child_process')
|
|
execSync('pkill -f "chrome|chromium" 2>/dev/null || true')
|
|
console.log('✅ EMERGENCY: Cleanup completed')
|
|
} catch (cleanupError) {
|
|
console.error('Cleanup error:', cleanupError.message)
|
|
}
|
|
|
|
return Response.json(result)
|
|
} catch (error) {
|
|
return Response.json({
|
|
success: false,
|
|
message: error.message
|
|
}, { status: 500 })
|
|
}
|
|
}
|