Actualizar server.js
This commit is contained in:
14
server.js
14
server.js
@@ -777,13 +777,13 @@ 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]);
|
||||||
|
|||||||
Reference in New Issue
Block a user