From fd0fad95e196f6663d4781a3e9a2ddc441cfeca7 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Wed, 30 Oct 2024 16:57:39 +0100 Subject: [PATCH] base rebuild order on last build attempt, not rustc date --- ...d840aed032502efbc26ce53ea89512a5d8163.json | 41 +++++++++++++++++++ ...57a4282b79c6c20859bb88a451afc3b1a404d.json | 35 ---------------- src/build_queue.rs | 17 +++++--- 3 files changed, 52 insertions(+), 41 deletions(-) create mode 100644 .sqlx/query-91511cc8904f313fa308b164d79d840aed032502efbc26ce53ea89512a5d8163.json delete mode 100644 .sqlx/query-dd1b692e4dc6aaa210f53b1cf3f57a4282b79c6c20859bb88a451afc3b1a404d.json diff --git a/.sqlx/query-91511cc8904f313fa308b164d79d840aed032502efbc26ce53ea89512a5d8163.json b/.sqlx/query-91511cc8904f313fa308b164d79d840aed032502efbc26ce53ea89512a5d8163.json new file mode 100644 index 000000000..b5adbb8c0 --- /dev/null +++ b/.sqlx/query-91511cc8904f313fa308b164d79d840aed032502efbc26ce53ea89512a5d8163.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT i.* FROM (\n SELECT\n c.name,\n r.version,\n (\n SELECT MAX(b.rustc_nightly_date)\n FROM builds AS b\n WHERE b.rid = r.id AND b.rustc_nightly_date IS NOT NULL\n ) AS rustc_nightly_date,\n (\n SELECT MAX(COALESCE(b.build_finished, b.build_started))\n FROM builds AS b\n WHERE b.rid = r.id\n ) AS last_build_attempt\n FROM crates AS c\n INNER JOIN releases AS r ON c.latest_version_id = r.id\n\n WHERE\n r.rustdoc_status = TRUE\n ) as i\n WHERE i.rustc_nightly_date < $1\n ORDER BY i.last_build_attempt ASC\n LIMIT $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Text" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "rustc_nightly_date", + "type_info": "Date" + }, + { + "ordinal": 3, + "name": "last_build_attempt", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Date", + "Int8" + ] + }, + "nullable": [ + false, + false, + null, + null + ] + }, + "hash": "91511cc8904f313fa308b164d79d840aed032502efbc26ce53ea89512a5d8163" +} diff --git a/.sqlx/query-dd1b692e4dc6aaa210f53b1cf3f57a4282b79c6c20859bb88a451afc3b1a404d.json b/.sqlx/query-dd1b692e4dc6aaa210f53b1cf3f57a4282b79c6c20859bb88a451afc3b1a404d.json deleted file mode 100644 index 1eede2b5e..000000000 --- a/.sqlx/query-dd1b692e4dc6aaa210f53b1cf3f57a4282b79c6c20859bb88a451afc3b1a404d.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.* FROM (\n SELECT\n c.name,\n r.version,\n max(b.rustc_nightly_date) as rustc_nightly_date\n\n FROM crates AS c\n INNER JOIN releases AS r ON c.latest_version_id = r.id\n INNER JOIN builds AS b ON r.id = b.rid\n\n WHERE\n r.rustdoc_status = TRUE\n\n GROUP BY c.name, r.version\n ) as i\n WHERE i.rustc_nightly_date < $1\n ORDER BY i.rustc_nightly_date ASC\n LIMIT $2", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "name", - "type_info": "Text" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Text" - }, - { - "ordinal": 2, - "name": "rustc_nightly_date", - "type_info": "Date" - } - ], - "parameters": { - "Left": [ - "Date", - "Int8" - ] - }, - "nullable": [ - false, - false, - null - ] - }, - "hash": "dd1b692e4dc6aaa210f53b1cf3f57a4282b79c6c20859bb88a451afc3b1a404d" -} diff --git a/src/build_queue.rs b/src/build_queue.rs index a40acc86c..3a843a4be 100644 --- a/src/build_queue.rs +++ b/src/build_queue.rs @@ -698,19 +698,24 @@ pub async fn queue_rebuilds( SELECT c.name, r.version, - max(b.rustc_nightly_date) as rustc_nightly_date - + ( + SELECT MAX(b.rustc_nightly_date) + FROM builds AS b + WHERE b.rid = r.id AND b.rustc_nightly_date IS NOT NULL + ) AS rustc_nightly_date, + ( + SELECT MAX(COALESCE(b.build_finished, b.build_started)) + FROM builds AS b + WHERE b.rid = r.id + ) AS last_build_attempt FROM crates AS c INNER JOIN releases AS r ON c.latest_version_id = r.id - INNER JOIN builds AS b ON r.id = b.rid WHERE r.rustdoc_status = TRUE - - GROUP BY c.name, r.version ) as i WHERE i.rustc_nightly_date < $1 - ORDER BY i.rustc_nightly_date ASC + ORDER BY i.last_build_attempt ASC LIMIT $2", config .rebuild_up_to_date