mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-30 21:29:44 -06:00
fix: cancellations, failures, and retries edge case (#1377)
This commit is contained in:
@@ -249,6 +249,11 @@ WITH input AS (
|
||||
step_id
|
||||
FROM
|
||||
v1_task
|
||||
-- only fail tasks which have a v1_task_runtime equivalent to the current retry count. otherwise,
|
||||
-- a cancellation which deletes the v1_task_runtime might lead to a future failure event, which triggers
|
||||
-- a retry.
|
||||
JOIN
|
||||
v1_task_runtime rt ON rt.task_id = v1_task.id AND rt.task_inserted_at = v1_task.inserted_at AND rt.retry_count = v1_task.retry_count
|
||||
WHERE
|
||||
(id, inserted_at) IN (SELECT task_id, task_inserted_at FROM input)
|
||||
AND tenant_id = @tenantId::uuid
|
||||
@@ -300,6 +305,11 @@ WITH input AS (
|
||||
id
|
||||
FROM
|
||||
v1_task
|
||||
-- only fail tasks which have a v1_task_runtime equivalent to the current retry count. otherwise,
|
||||
-- a cancellation which deletes the v1_task_runtime might lead to a future failure event, which triggers
|
||||
-- a retry.
|
||||
JOIN
|
||||
v1_task_runtime rt ON rt.task_id = v1_task.id AND rt.task_inserted_at = v1_task.inserted_at AND rt.retry_count = v1_task.retry_count
|
||||
WHERE
|
||||
(id, inserted_at) IN (SELECT task_id, task_inserted_at FROM input)
|
||||
AND tenant_id = @tenantId::uuid
|
||||
|
||||
@@ -91,6 +91,11 @@ WITH input AS (
|
||||
step_id
|
||||
FROM
|
||||
v1_task
|
||||
-- only fail tasks which have a v1_task_runtime equivalent to the current retry count. otherwise,
|
||||
-- a cancellation which deletes the v1_task_runtime might lead to a future failure event, which triggers
|
||||
-- a retry.
|
||||
JOIN
|
||||
v1_task_runtime rt ON rt.task_id = v1_task.id AND rt.task_inserted_at = v1_task.inserted_at AND rt.retry_count = v1_task.retry_count
|
||||
WHERE
|
||||
(id, inserted_at) IN (SELECT task_id, task_inserted_at FROM input)
|
||||
AND tenant_id = $3::uuid
|
||||
@@ -185,6 +190,11 @@ WITH input AS (
|
||||
id
|
||||
FROM
|
||||
v1_task
|
||||
-- only fail tasks which have a v1_task_runtime equivalent to the current retry count. otherwise,
|
||||
-- a cancellation which deletes the v1_task_runtime might lead to a future failure event, which triggers
|
||||
-- a retry.
|
||||
JOIN
|
||||
v1_task_runtime rt ON rt.task_id = v1_task.id AND rt.task_inserted_at = v1_task.inserted_at AND rt.retry_count = v1_task.retry_count
|
||||
WHERE
|
||||
(id, inserted_at) IN (SELECT task_id, task_inserted_at FROM input)
|
||||
AND tenant_id = $4::uuid
|
||||
|
||||
Reference in New Issue
Block a user