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