Clear finished jobs' steps a minute after they end
Job steps (bots_queue_updates) only feed the live working row, so the new clear-job-steps cron deletes them shortly after a job ends, however it ended, keeping their count on bots_queue.steps for the message details. Not done the moment a job ends: the live relay would miss the last ones. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -105,7 +105,7 @@ async function grabJob({ job_id }: { job_id: number }): Promise<MessageDetailsJo
|
||||
const row = (
|
||||
await BunSQLite.sql<JobRow>({
|
||||
sql: `SELECT q.id, q.kind, q.title, q.status, q.attempts, q.started_at, q.finished_at,
|
||||
(SELECT COUNT(*) FROM bots_queue_updates u WHERE u.bots_queue_id = q.id) AS steps
|
||||
COALESCE(q.steps, 0) + (SELECT COUNT(*) FROM bots_queue_updates u WHERE u.bots_queue_id = q.id) AS steps
|
||||
FROM bots_queue q WHERE q.id = ? LIMIT 1`,
|
||||
values: [job_id],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user