Actualizar server.js
This commit is contained in:
11
server.js
11
server.js
@@ -3925,8 +3925,15 @@ setInterval(async () => {
|
||||
const cpMatch = todoElTexto.match(/\b\d{5}\b/);
|
||||
const cpFinal = cpMatch ? cpMatch[0] : "00000";
|
||||
|
||||
// 🔥 Disparamos la bolsa
|
||||
await dispatchToBolsa(svc.id, finalGuildId, cpFinal, svc.owner_id, null);
|
||||
// 🔥 Disparamos la bolsa y guardamos el resultado
|
||||
const dispatchResult = await dispatchToBolsa(svc.id, finalGuildId, cpFinal, svc.owner_id, null);
|
||||
|
||||
// 🛑 ESCUDO ANTI-BUCLE: Si falla porque no hay operarios en ese CP,
|
||||
// marcamos la urgencia como "failed" para que el reloj deje de intentarlo eternamente.
|
||||
if (!dispatchResult.ok) {
|
||||
console.log(`🛑 [ESCUDO] Abortando bucle para #${svc.service_ref}. Marcado como 'failed'.`);
|
||||
await client.query("UPDATE scraped_services SET automation_status = 'failed' WHERE id = $1", [svc.id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user