Actualizar server.js

This commit is contained in:
2026-02-16 07:53:17 +00:00
parent 9ac5a78bfd
commit 4fb4464a0b

View File

@@ -778,12 +778,12 @@ app.delete("/services/:id", authMiddleware, async (req, res) => { try { await po
setInterval(async () => { setInterval(async () => {
try { try {
const expiredPings = await pool.query(` const expiredPings = await pool.query(`
SELECT ap.id, ap.scraped_id, ap.user_id, s.owner_id, s.raw_data             SELECT ap.id, ap.scraped_id, ap.user_id, s.owner_id, s.raw_data
FROM assignment_pings ap             FROM assignment_pings ap
JOIN scraped_services s ON ap.scraped_id = s.id             JOIN scraped_services s ON ap.scraped_id = s.id
WHERE ap.status = 'pending' AND ap.expires_at < NOW()             WHERE ap.status = 'pending' AND ap.expires_at < $1
AND s.automation_status = 'in_progress'             AND s.automation_status = 'in_progress'
`);         `, [new Date()]); // <-- El reloj busca comparando con la hora actual de Node
for (const ping of expiredPings.rows) { for (const ping of expiredPings.rows) {
await pool.query("UPDATE assignment_pings SET status = 'expired' WHERE id = $1", [ping.id]); await pool.query("UPDATE assignment_pings SET status = 'expired' WHERE id = $1", [ping.id]);