do not restart flow as zombie job

This commit is contained in:
Ruben Fiszel
2022-09-26 00:45:26 +02:00
parent 25724e5f89
commit b87a498087
2 changed files with 2 additions and 24 deletions
-23
View File
@@ -2542,29 +2542,6 @@
},
"query": "SELECT * from workspace_invite WHERE workspace_id = $1"
},
"b546ee85fb214887ffcf81614518cf5dc3a566e1042df8f3c9ae227c3f3d9bf2": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Uuid"
}
],
"nullable": [
false
],
"parameters": {
"Left": [
"Varchar",
"Text",
"Uuid",
"Text"
]
}
},
"query": "UPDATE queue SET canceled = true, canceled_by = $1, canceled_reason = $2 WHERE id = $3 AND schedule_path IS NULL AND workspace_id = $4 RETURNING id"
},
"b7dd791cd69748ef51b7520f505c0c8bb1b4014a273476eddfecf1ab658a18b4": {
"describe": {
"columns": [
+2 -1
View File
@@ -1652,8 +1652,9 @@ pub async fn restart_zombie_jobs_periodically(
) {
loop {
let restarted = sqlx::query!(
"UPDATE queue SET running = false WHERE last_ping < now() - ($1 || ' seconds')::interval and running = true RETURNING id, workspace_id, last_ping",
"UPDATE queue SET running = false WHERE last_ping < now() - ($1 || ' seconds')::interval AND running = true AND job_kind != $2 RETURNING id, workspace_id, last_ping",
(timeout * 5).to_string(),
JobKind::Flow: JobKind,
)
.fetch_all(db)
.await