Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions database/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub trait Connection: Send + Sync {

async fn load_index(&mut self) -> Index;

/// Returns true if the given database backend supports the job queue system.
fn supports_job_queue(&self) -> bool;

/// None means that the caller doesn't know; it should be left alone if
/// known or set to false if unknown.
async fn record_compile_benchmark(
Expand Down
4 changes: 4 additions & 0 deletions database/src/pool/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2335,6 +2335,10 @@ where
.await?;
Ok(())
}

fn supports_job_queue(&self) -> bool {
true
}
}

fn row_to_benchmark_request(row: &Row, row_offset: Option<usize>) -> BenchmarkRequest {
Expand Down
8 changes: 7 additions & 1 deletion database/src/pool/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,9 @@ impl Connection for SqliteConnection {
}

async fn load_benchmark_request_index(&self) -> anyhow::Result<BenchmarkRequestIndex> {
no_queue_implementation_abort!()
Ok(BenchmarkRequestIndex {
all: Default::default(),
})
}

async fn load_pending_benchmark_requests(&self) -> anyhow::Result<PendingBenchmarkRequests> {
Expand Down Expand Up @@ -1438,6 +1440,10 @@ impl Connection for SqliteConnection {
) -> anyhow::Result<Vec<BenchmarkRequestWithErrors>> {
no_queue_implementation_abort!()
}

fn supports_job_queue(&self) -> bool {
false
}
}

fn parse_artifact_id(ty: &str, sha: &str, date: Option<i64>) -> ArtifactId {
Expand Down
3 changes: 3 additions & 0 deletions site/src/job_queue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ async fn process_benchmark_requests(
/// finishes completed benchmark requests.
async fn perform_queue_tick(ctxt: &SiteCtxt) -> anyhow::Result<()> {
let mut conn = ctxt.conn().await;
if !conn.supports_job_queue() {
return Ok(());
}

let index = ctxt.known_benchmark_requests.load();

Expand Down
Loading