You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes 4927: add flag to prevent requeuing canceled tasks (#875)
* Fixes 4927: add flag to prevent requeuing canceled tasks
* set cancel_attempted in cancel query instead
* only include tasks that were not cancelled in requeueFailedTasks query
* address comments
SELECT * FROM tasks t LEFT JOIN task_dependencies td ON (t.id = td.dependency_id)
57
-
WHERE (started_at IS NOT NULL AND finished_at IS NOT NULL AND status = 'failed' AND retries < 3 AND next_retry_time <= clock_timestamp() AND type = ANY($1::text[]))
57
+
WHERE (started_at IS NOT NULL AND finished_at IS NOT NULL AND status = 'failed' AND retries < 3 AND next_retry_time <= clock_timestamp() AND type = ANY($1::text[]) AND cancel_attempted = false)
OR (tasks.started_at IS NOT NULL AND tasks.finished_at IS NOT NULL AND tasks.status = 'failed' AND tasks.retries < 3 AND tasks.next_retry_time <= clock_timestamp() AND tasks.type = ANY($1::text[]))
64
+
OR (tasks.started_at IS NOT NULL AND tasks.finished_at IS NOT NULL AND tasks.status = 'failed' AND tasks.retries < 3 AND tasks.next_retry_time <= clock_timestamp() AND tasks.type = ANY($1::text[]) AND tasks.cancel_attempted = false)
65
65
) t1
66
66
WHERE tasks.id = t1.id`
67
67
@@ -96,7 +96,7 @@ const (
96
96
RETURNING finished_at`
97
97
sqlCancelTask=`
98
98
UPDATE tasks
99
-
SET status = 'canceled', error = (left($2, 4000))
99
+
SET status = 'canceled', error = (left($2, 4000)), cancel_attempted = true
0 commit comments