diff --git a/rust/.sqlx/query-c07f8903946884df7a929ee10c711c55d8984fddb2a96041065f2153d2b41dc5.json b/rust/.sqlx/query-385e94f4adab0f85174968f6eee873bf6d1d43884cd628df5b36978dd761b025.json similarity index 57% rename from rust/.sqlx/query-c07f8903946884df7a929ee10c711c55d8984fddb2a96041065f2153d2b41dc5.json rename to rust/.sqlx/query-385e94f4adab0f85174968f6eee873bf6d1d43884cd628df5b36978dd761b025.json index 367d6c93a6c80..5c6b66d3f8739 100644 --- a/rust/.sqlx/query-c07f8903946884df7a929ee10c711c55d8984fddb2a96041065f2153d2b41dc5.json +++ b/rust/.sqlx/query-385e94f4adab0f85174968f6eee873bf6d1d43884cd628df5b36978dd761b025.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\nDELETE FROM cyclotron_jobs WHERE state = 'running' AND COALESCE(last_heartbeat, $1) <= $1 AND janitor_touch_count >= $2 returning id\n ", + "query": "\nSELECT id FROM cyclotron_jobs WHERE state = 'running' AND COALESCE(last_heartbeat, $1) <= $1 AND janitor_touch_count >= $2\n ", "describe": { "columns": [ { @@ -14,5 +14,5 @@ }, "nullable": [false] }, - "hash": "c07f8903946884df7a929ee10c711c55d8984fddb2a96041065f2153d2b41dc5" + "hash": "385e94f4adab0f85174968f6eee873bf6d1d43884cd628df5b36978dd761b025" } diff --git a/rust/cyclotron-core/src/ops/janitor.rs b/rust/cyclotron-core/src/ops/janitor.rs index dcf80dad767c9..16bdb9180f0f9 100644 --- a/rust/cyclotron-core/src/ops/janitor.rs +++ b/rust/cyclotron-core/src/ops/janitor.rs @@ -71,7 +71,7 @@ where // and would be useful to report. let result = sqlx::query_scalar!( r#" -DELETE FROM cyclotron_jobs WHERE state = 'running' AND COALESCE(last_heartbeat, $1) <= $1 AND janitor_touch_count >= $2 returning id +SELECT id FROM cyclotron_jobs WHERE state = 'running' AND COALESCE(last_heartbeat, $1) <= $1 AND janitor_touch_count >= $2 "#, oldest_valid_heartbeat, max_janitor_touched