Create and use Reachable primitive

This commit is contained in:
Joscha 2024-05-13 16:04:02 +02:00
parent 5a4784be56
commit 7d80ba4a6b
24 changed files with 136 additions and 87 deletions

View file

@ -1,12 +1,12 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "INSERT OR IGNORE INTO queue (hash, date, priority) SELECT hash, ?, ? FROM commits LEFT JOIN runs USING (hash) WHERE reachable = 2 AND id IS NULL ORDER BY unixepoch(committer_date) DESC LIMIT ? ", "query": "INSERT OR IGNORE INTO queue (hash, date, priority) SELECT hash, ?, ? FROM commits LEFT JOIN runs USING (hash) WHERE reachable = ? AND id IS NULL ORDER BY unixepoch(committer_date) DESC LIMIT ? ",
"describe": { "describe": {
"columns": [], "columns": [],
"parameters": { "parameters": {
"Right": 3 "Right": 4
}, },
"nullable": [] "nullable": []
}, },
"hash": "ee811ca799590d80f1c76a8625ab22c584e528b4dac6ee1103c071eb29282f17" "hash": "1b572ecd6904a13d78070bc6aeef3a4f349baa5b880aaa1d141b516a34517b4b"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT name, hash, message, reachable, tracked FROM refs JOIN commits USING (hash) ORDER BY name ASC ", "query": "SELECT name, hash, message, reachable AS \"reachable: Reachable\", tracked FROM refs JOIN commits USING (hash) ORDER BY name ASC ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -19,7 +19,7 @@
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "reachable", "name": "reachable: Reachable",
"ordinal": 3, "ordinal": 3,
"type_info": "Int64" "type_info": "Int64"
}, },
@ -40,5 +40,5 @@
false false
] ]
}, },
"hash": "c7a4115d81a3371d77afadfdad7dbe47c4d1d23211a35c0c68174f9ce82893c2" "hash": "1df8ec0b41dbafe191f6990d6be6f6f3c9d86ea9ca8112f16b5735b1193ea243"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT hash, author, message, committer_date AS \"committer_date: OffsetDateTime\" FROM commits WHERE reachable = 2 ORDER BY hash ASC ", "query": "SELECT hash, author, message, committer_date AS \"committer_date: OffsetDateTime\" FROM commits WHERE reachable = ? ORDER BY hash ASC ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -25,7 +25,7 @@
} }
], ],
"parameters": { "parameters": {
"Right": 0 "Right": 1
}, },
"nullable": [ "nullable": [
false, false,
@ -34,5 +34,5 @@
false false
] ]
}, },
"hash": "6c766f5d504a19061a551b0b11b1558d08702ff3656331cb2595c9dc311cd870" "hash": "2d4ddb045e286955334793d7610f1f1ee1d7d825031b003db6117231a16d2f50"
} }

View file

@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "UPDATE commits SET new = false WHERE reachable = 2",
"describe": {
"columns": [],
"parameters": {
"Right": 0
},
"nullable": []
},
"hash": "3d48dcc84c3d624f7a9f9ebd0399aa9786cb94e2ddda6016fc0e8e0fee46fc98"
}

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT hash, message, reachable FROM commits JOIN commit_edges ON hash = parent WHERE child = ? ORDER BY reachable DESC, unixepoch(committer_date) ASC ", "query": "SELECT hash, message, reachable AS \"reachable: Reachable\" FROM commits JOIN commit_edges ON hash = child WHERE parent = ? ORDER BY reachable DESC, unixepoch(committer_date) ASC ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -14,7 +14,7 @@
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "reachable", "name": "reachable: Reachable",
"ordinal": 2, "ordinal": 2,
"type_info": "Int64" "type_info": "Int64"
} }
@ -28,5 +28,5 @@
false false
] ]
}, },
"hash": "3514cb91d76683ccdf40ef732ae6062327d6b4aa1acd96632cb934b2d8495b9d" "hash": "3edd8ce2a6fbb36433684d259d073cca1df369461ae8e0c357ebaba2e08186e5"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT hash FROM commits WHERE new AND reachable = 2", "query": "SELECT hash FROM commits WHERE new AND reachable = ?",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -10,11 +10,11 @@
} }
], ],
"parameters": { "parameters": {
"Right": 0 "Right": 1
}, },
"nullable": [ "nullable": [
false false
] ]
}, },
"hash": "726102c4f61f95047a64cdc21834d0a5544950ecfe9b1d6716521dcf1d0b8fb2" "hash": "4adebcd260affd90435d3b3b3cf1bbee3bec22d5745b45184c3f555b9c5e9e31"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT hash, message, reachable FROM commits JOIN commit_edges ON hash = child WHERE parent = ? ORDER BY reachable DESC, unixepoch(committer_date) ASC ", "query": "SELECT hash, message, reachable AS \"reachable: Reachable\" FROM commits JOIN commit_edges ON hash = parent WHERE child = ? ORDER BY reachable DESC, unixepoch(committer_date) ASC ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -14,7 +14,7 @@
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "reachable", "name": "reachable: Reachable",
"ordinal": 2, "ordinal": 2,
"type_info": "Int64" "type_info": "Int64"
} }
@ -28,5 +28,5 @@
false false
] ]
}, },
"hash": "a6d9bfe6d0cd4677074341cebe6a3cc9c1ed2273ab238bd18a435abff4564c67" "hash": "595f95ecdafb7c94bcf4cc81222e207079e2da3779a1ce3c8b5833e335faf130"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT hash, message, reachable, date AS \"date: time::OffsetDateTime\", priority FROM queue JOIN commits USING (hash) ORDER BY priority DESC, unixepoch(date) DESC, hash ASC ", "query": "SELECT hash, message, reachable AS \"reachable: Reachable\", date AS \"date: time::OffsetDateTime\", priority FROM queue JOIN commits USING (hash) ORDER BY priority DESC, unixepoch(date) DESC, hash ASC ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -14,7 +14,7 @@
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "reachable", "name": "reachable: Reachable",
"ordinal": 2, "ordinal": 2,
"type_info": "Int64" "type_info": "Int64"
}, },
@ -40,5 +40,5 @@
false false
] ]
}, },
"hash": "6c9e27efd2c88772bbf1f89bf53d0abb49cd82788b1e88e4e2ef153b0f35a8fb" "hash": "5da81c9c9875bf4fd4e894ca54be65aee3d76a26c12feb1e4f25e9f482cd153e"
} }

View file

@ -1,12 +1,12 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "WITH RECURSIVE tracked (hash) AS ( SELECT hash FROM refs WHERE tracked UNION SELECT parent FROM commit_edges JOIN tracked ON hash = child ), reachable (hash) AS ( SELECT hash FROM refs UNION SELECT hash FROM tracked UNION SELECT parent FROM commit_edges JOIN reachable ON hash = child ) UPDATE commits SET reachable = CASE WHEN hash IN tracked THEN 2 WHEN hash IN reachable THEN 1 ELSE 0 END ", "query": "WITH RECURSIVE tracked (hash) AS ( SELECT hash FROM refs WHERE tracked UNION SELECT parent FROM commit_edges JOIN tracked ON hash = child ), reachable (hash) AS ( SELECT hash FROM refs UNION SELECT hash FROM tracked UNION SELECT parent FROM commit_edges JOIN reachable ON hash = child ) UPDATE commits SET reachable = CASE WHEN hash IN tracked THEN ? WHEN hash IN reachable THEN ? ELSE ? END ",
"describe": { "describe": {
"columns": [], "columns": [],
"parameters": { "parameters": {
"Right": 0 "Right": 3
}, },
"nullable": [] "nullable": []
}, },
"hash": "32f0ac59687e5455bb38060dc1d6cd181a86cd6ca7ac2f583a33212c8b7bef1a" "hash": "7808509e5f7d1c7e8138ff9e124ab3b1784a05ac771778ff8e503ae20d319c08"
} }

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "UPDATE commits SET new = false WHERE reachable = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "b59a8a7243290e78dbfedc6b2577097bc0220317ad69eb22173ae8cf8c85a0d3"
}

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT child, parent FROM commit_edges JOIN commits ON hash = child WHERE reachable = 2 ORDER BY hash ASC ", "query": "SELECT child, parent FROM commit_edges JOIN commits ON hash = child WHERE reachable = ? ORDER BY hash ASC ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -15,12 +15,12 @@
} }
], ],
"parameters": { "parameters": {
"Right": 0 "Right": 1
}, },
"nullable": [ "nullable": [
false, false,
false false
] ]
}, },
"hash": "5092d460f9bd489e2a5905c1ae3e3d3b3c946c427e1dd7d2d723f6aab5acd636" "hash": "ba09c191e2a83d4398b26888f041c93095ba82693b0b9c2c2eebd65078f7d168"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT hash, author, author_date AS \"author_date: time::OffsetDateTime\", committer, committer_date AS \"committer_date: time::OffsetDateTime\", message, reachable FROM commits WHERE hash = ? ", "query": "SELECT hash, author, author_date AS \"author_date: time::OffsetDateTime\", committer, committer_date AS \"committer_date: time::OffsetDateTime\", message, reachable AS \"reachable: Reachable\" FROM commits WHERE hash = ? ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -34,7 +34,7 @@
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "reachable", "name": "reachable: Reachable",
"ordinal": 6, "ordinal": 6,
"type_info": "Int64" "type_info": "Int64"
} }
@ -52,5 +52,5 @@
false false
] ]
}, },
"hash": "a42862017ade20eb742a9761c1b581d4c902dfe12e36a504cc111a9d38407196" "hash": "c75001269238285e4de8d609a404b7249df61711324b3cae4c21b74b0875100d"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT id, hash, bench_method, start AS \"start: time::OffsetDateTime\", end AS \"end: time::OffsetDateTime\", exit_code, message, reachable FROM runs JOIN commits USING (hash) WHERE id = ? ", "query": "SELECT id, hash, bench_method, start AS \"start: time::OffsetDateTime\", end AS \"end: time::OffsetDateTime\", exit_code, message, reachable AS \"reachable: Reachable\" FROM runs JOIN commits USING (hash) WHERE id = ? ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -39,7 +39,7 @@
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "reachable", "name": "reachable: Reachable",
"ordinal": 7, "ordinal": 7,
"type_info": "Int64" "type_info": "Int64"
} }
@ -58,5 +58,5 @@
false false
] ]
}, },
"hash": "26bf8f43e0fa607ddfabb0611ee95c8ed1fef2d1aa76749b660228cd38a84283" "hash": "daae5a05af0e8a511f5099820da2ccbeebb577935786fdb1a235d0315bc5a433"
} }

View file

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "SELECT hash, message, reachable FROM commits JOIN queue USING (hash) WHERE hash = ? ", "query": "SELECT hash, message, reachable AS \"reachable: Reachable\" FROM commits JOIN queue USING (hash) WHERE hash = ? ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -14,7 +14,7 @@
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "reachable", "name": "reachable: Reachable",
"ordinal": 2, "ordinal": 2,
"type_info": "Int64" "type_info": "Int64"
} }
@ -28,5 +28,5 @@
false false
] ]
}, },
"hash": "c1e772c34a0324159ca1ee204806c3774762a3df4c6d06a4ea4df67b105bac00" "hash": "dcd37f22be87b31a7edaba2c4225d3ddfb9802c532102036e1d2ec3cd1adc51f"
} }

View file

@ -22,6 +22,15 @@ pub enum Direction {
MoreIsBetter = 1, MoreIsBetter = 1,
} }
/// How a commit can be reached from refs.
#[derive(Debug, Clone, Serialize_repr, Deserialize_repr, sqlx::Type)]
#[repr(u8)]
pub enum Reachable {
Unreachable = 0,
FromAnyRef = 1,
FromTrackedRef = 2,
}
/// A time stamp, usually formatted using RFC3339. /// A time stamp, usually formatted using RFC3339.
#[derive(Clone, Copy, sqlx::Type)] #[derive(Clone, Copy, sqlx::Type)]
#[sqlx(transparent)] #[sqlx(transparent)]

View file

@ -2,14 +2,17 @@ use log::{debug, info, warn};
use sqlx::{Acquire, SqlitePool}; use sqlx::{Acquire, SqlitePool};
use time::OffsetDateTime; use time::OffsetDateTime;
use crate::somehow; use crate::{primitive::Reachable, somehow};
async fn inner(db: &SqlitePool) -> somehow::Result<()> { async fn inner(db: &SqlitePool) -> somehow::Result<()> {
let mut tx = db.begin().await?; let mut tx = db.begin().await?;
let conn = tx.acquire().await?; let conn = tx.acquire().await?;
// Get all newly added tracked commits // Get all newly added tracked commits
let new = sqlx::query!("SELECT hash FROM commits WHERE new AND reachable = 2") let new = sqlx::query!(
"SELECT hash FROM commits WHERE new AND reachable = ?",
Reachable::FromTrackedRef,
)
.fetch_all(&mut *conn) .fetch_all(&mut *conn)
.await?; .await?;
debug!("Found {} new commits", new.len()); debug!("Found {} new commits", new.len());
@ -38,10 +41,14 @@ async fn inner(db: &SqlitePool) -> somehow::Result<()> {
// //
// When tracked refs are updated, all new commits are automatically added to // When tracked refs are updated, all new commits are automatically added to
// the queue, since they were still new and have now transitioned to // the queue, since they were still new and have now transitioned to
// reachable = 2. This should hopefully not be too big of a problem since // Reachable::FromTrackedRef. This should hopefully not be too big of a
// usually the main branch is also tracked. I think I'd rather implement // problem since usually the main branch is also tracked. I think I'd rather
// better queue management tools and graph UI than change this behaviour. // implement better queue management tools and graph UI than change this
let amount = sqlx::query!("UPDATE commits SET new = false WHERE reachable = 2") // behaviour.
let amount = sqlx::query!(
"UPDATE commits SET new = false WHERE reachable = ?",
Reachable::FromTrackedRef,
)
.execute(&mut *conn) .execute(&mut *conn)
.await? .await?
.rows_affected(); .rows_affected();

View file

@ -9,6 +9,7 @@ use sqlx::{Acquire, SqliteConnection, SqlitePool};
use time::{OffsetDateTime, UtcOffset}; use time::{OffsetDateTime, UtcOffset};
use crate::{ use crate::{
primitive::Reachable,
server::{format, Repo}, server::{format, Repo},
somehow, somehow,
}; };
@ -227,11 +228,14 @@ async fn update_commit_tracked_status(conn: &mut SqliteConnection) -> somehow::R
) \ ) \
UPDATE commits \ UPDATE commits \
SET reachable = CASE \ SET reachable = CASE \
WHEN hash IN tracked THEN 2 \ WHEN hash IN tracked THEN ? \
WHEN hash IN reachable THEN 1 \ WHEN hash IN reachable THEN ? \
ELSE 0 \ ELSE ? \
END \ END \
" ",
Reachable::FromTrackedRef,
Reachable::FromAnyRef,
Reachable::Unreachable,
) )
.execute(conn) .execute(conn)
.await?; .await?;

View file

@ -10,6 +10,7 @@ use time::OffsetDateTime;
use crate::{ use crate::{
config::ServerConfig, config::ServerConfig,
primitive::Reachable,
server::web::{ server::web::{
paths::{ paths::{
PathAdminQueueAdd, PathAdminQueueAddBatch, PathAdminQueueDecrease, PathAdminQueueAdd, PathAdminQueueAddBatch, PathAdminQueueDecrease,
@ -75,12 +76,13 @@ pub async fn post_admin_queue_add_batch(
SELECT hash, ?, ? \ SELECT hash, ?, ? \
FROM commits \ FROM commits \
LEFT JOIN runs USING (hash) \ LEFT JOIN runs USING (hash) \
WHERE reachable = 2 AND id IS NULL \ WHERE reachable = ? AND id IS NULL \
ORDER BY unixepoch(committer_date) DESC \ ORDER BY unixepoch(committer_date) DESC \
LIMIT ? \ LIMIT ? \
", ",
date, date,
form.priority, form.priority,
Reachable::FromTrackedRef,
form.amount, form.amount,
) )
.execute(&db) .execute(&db)

View file

@ -1,7 +1,7 @@
use maud::{html, Markup}; use maud::{html, Markup};
use time::OffsetDateTime; use time::OffsetDateTime;
use crate::{config::ServerConfig, server::format}; use crate::{config::ServerConfig, primitive::Reachable, server::format};
use super::{ use super::{
paths::{PathCommitByHash, PathRunById, PathWorkerByName}, paths::{PathCommitByHash, PathRunById, PathWorkerByName},
@ -17,26 +17,29 @@ pub fn join(sections: &[Markup], with: Markup) -> Markup {
} }
} }
pub fn commit_class_and_title(reachable: i64) -> (&'static str, &'static str) { pub fn commit_class_and_title(reachable: Reachable) -> (&'static str, &'static str) {
if reachable == 0 { match reachable {
( Reachable::Unreachable => (
"commit-orphaned", "commit-orphaned",
"This commit is orphaned. It can't be reached from any ref.", "This commit is orphaned. It can't be reached from any ref.",
) ),
} else if reachable == -1 { Reachable::FromAnyRef => (
(
"commit-reachable", "commit-reachable",
"This commit can only be reached from untracked refs.", "This commit can only be reached from untracked refs.",
) ),
} else { Reachable::FromTrackedRef => (
(
"commit-tracked", "commit-tracked",
"This commit can be reached from a tracked ref.", "This commit can be reached from a tracked ref.",
) ),
} }
} }
pub fn link_commit(config: &ServerConfig, hash: String, message: &str, reachable: i64) -> Markup { pub fn link_commit(
config: &ServerConfig,
hash: String,
message: &str,
reachable: Reachable,
) -> Markup {
let short = format::truncate(&format::commit_short(&hash, message), 80); let short = format::truncate(&format::commit_short(&hash, message), 80);
let path = config.path(PathCommitByHash { hash }); let path = config.path(PathCommitByHash { hash });
let (class, title) = commit_class_and_title(reachable); let (class, title) = commit_class_and_title(reachable);

View file

@ -9,6 +9,7 @@ use sqlx::SqlitePool;
use crate::{ use crate::{
config::ServerConfig, config::ServerConfig,
primitive::Reachable,
server::{ server::{
format, format,
web::{ web::{
@ -35,7 +36,7 @@ pub async fn get_commit_by_hash(
committer, \ committer, \
committer_date AS \"committer_date: time::OffsetDateTime\", \ committer_date AS \"committer_date: time::OffsetDateTime\", \
message, \ message, \
reachable \ reachable AS \"reachable: Reachable\" \
FROM commits \ FROM commits \
WHERE hash = ? \ WHERE hash = ? \
", ",
@ -49,7 +50,11 @@ pub async fn get_commit_by_hash(
let parents = sqlx::query!( let parents = sqlx::query!(
"\ "\
SELECT hash, message, reachable FROM commits \ SELECT \
hash, \
message, \
reachable AS \"reachable: Reachable\" \
FROM commits \
JOIN commit_edges ON hash = parent \ JOIN commit_edges ON hash = parent \
WHERE child = ? \ WHERE child = ? \
ORDER BY reachable DESC, unixepoch(committer_date) ASC \ ORDER BY reachable DESC, unixepoch(committer_date) ASC \
@ -63,7 +68,11 @@ pub async fn get_commit_by_hash(
let children = sqlx::query!( let children = sqlx::query!(
"\ "\
SELECT hash, message, reachable FROM commits \ SELECT \
hash, \
message, \
reachable AS \"reachable: Reachable\" \
FROM commits \
JOIN commit_edges ON hash = child \ JOIN commit_edges ON hash = child \
WHERE parent = ? \ WHERE parent = ? \
ORDER BY reachable DESC, unixepoch(committer_date) ASC \ ORDER BY reachable DESC, unixepoch(committer_date) ASC \

View file

@ -10,6 +10,7 @@ use time::OffsetDateTime;
use crate::{ use crate::{
config::ServerConfig, config::ServerConfig,
primitive::Reachable,
server::{ server::{
format, format,
web::{ web::{
@ -99,9 +100,10 @@ pub async fn get_graph_commits(
message, \ message, \
committer_date AS \"committer_date: OffsetDateTime\" \ committer_date AS \"committer_date: OffsetDateTime\" \
FROM commits \ FROM commits \
WHERE reachable = 2 \ WHERE reachable = ? \
ORDER BY hash ASC \ ORDER BY hash ASC \
" ",
Reachable::FromTrackedRef,
) )
.fetch(&mut *conn); .fetch(&mut *conn);
while let Some(row) = rows.try_next().await? { while let Some(row) = rows.try_next().await? {
@ -126,9 +128,10 @@ pub async fn get_graph_commits(
SELECT child, parent \ SELECT child, parent \
FROM commit_edges \ FROM commit_edges \
JOIN commits ON hash = child \ JOIN commits ON hash = child \
WHERE reachable = 2 \ WHERE reachable = ? \
ORDER BY hash ASC \ ORDER BY hash ASC \
" ",
Reachable::FromTrackedRef,
) )
.fetch(&mut *conn); .fetch(&mut *conn);
while let Some(row) = rows.try_next().await? { while let Some(row) = rows.try_next().await? {

View file

@ -5,6 +5,7 @@ use sqlx::SqlitePool;
use crate::{ use crate::{
config::ServerConfig, config::ServerConfig,
primitive::Reachable,
server::web::{ server::web::{
components, components,
page::{Page, Tab}, page::{Page, Tab},
@ -27,7 +28,12 @@ pub async fn get_index(
) -> somehow::Result<impl IntoResponse> { ) -> somehow::Result<impl IntoResponse> {
let refs = sqlx::query!( let refs = sqlx::query!(
"\ "\
SELECT name, hash, message, reachable, tracked \ SELECT \
name, \
hash, \
message, \
reachable AS \"reachable: Reachable\", \
tracked \
FROM refs \ FROM refs \
JOIN commits USING (hash) \ JOIN commits USING (hash) \
ORDER BY name ASC \ ORDER BY name ASC \

View file

@ -14,6 +14,7 @@ use sqlx::SqlitePool;
use crate::{ use crate::{
config::ServerConfig, config::ServerConfig,
primitive::Reachable,
server::{ server::{
format, format,
web::{ web::{
@ -120,7 +121,7 @@ async fn get_queue_data(
SELECT \ SELECT \
hash, \ hash, \
message, \ message, \
reachable, \ reachable AS \"reachable: Reachable\", \
date AS \"date: time::OffsetDateTime\", \ date AS \"date: time::OffsetDateTime\", \
priority \ priority \
FROM queue \ FROM queue \
@ -276,7 +277,11 @@ pub async fn get_queue_delete(
) -> somehow::Result<Response> { ) -> somehow::Result<Response> {
let Some(r) = sqlx::query!( let Some(r) = sqlx::query!(
"\ "\
SELECT hash, message, reachable FROM commits \ SELECT \
hash, \
message, \
reachable AS \"reachable: Reachable\" \
FROM commits \
JOIN queue USING (hash) \ JOIN queue USING (hash) \
WHERE hash = ? \ WHERE hash = ? \
", ",

View file

@ -9,6 +9,7 @@ use sqlx::SqlitePool;
use crate::{ use crate::{
config::ServerConfig, config::ServerConfig,
primitive::Reachable,
server::{ server::{
format, format,
web::{components, page::Page, paths::PathRunById}, web::{components, page::Page, paths::PathRunById},
@ -42,7 +43,7 @@ async fn from_finished_run(
end AS \"end: time::OffsetDateTime\", \ end AS \"end: time::OffsetDateTime\", \
exit_code, \ exit_code, \
message, \ message, \
reachable \ reachable AS \"reachable: Reachable\" \
FROM runs \ FROM runs \
JOIN commits USING (hash) \ JOIN commits USING (hash) \
WHERE id = ? \ WHERE id = ? \