Skip to content

Commit 962de49

Browse files
committed
Fix Clippy lints and update docs
1 parent 84eac26 commit 962de49

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

site/src/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ async fn attach_shas_to_try_benchmark_request(
250250
)
251251
.await
252252
{
253-
log::error!("Failed to add shas to try commit {}", e);
253+
log::error!("Failed to add shas to try commit: {e:?}");
254254
}
255255
}
256256
}

site/src/job_queue/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn run_new_queue() -> bool {
2222
/// Store the latest master commits or do nothing if all of them are
2323
/// already in the database
2424
async fn create_benchmark_request_master_commits(
25-
ctxt: &Arc<SiteCtxt>,
25+
ctxt: &SiteCtxt,
2626
conn: &dyn database::pool::Connection,
2727
index: &BenchmarkRequestIndex,
2828
) -> anyhow::Result<()> {
@@ -282,7 +282,7 @@ async fn process_benchmark_requests(
282282
}
283283

284284
/// For queueing jobs, add the jobs you want to queue to this function
285-
async fn cron_enqueue_jobs(site_ctxt: &Arc<SiteCtxt>) -> anyhow::Result<()> {
285+
async fn cron_enqueue_jobs(site_ctxt: &SiteCtxt) -> anyhow::Result<()> {
286286
let mut conn = site_ctxt.conn().await;
287287

288288
let index = conn.load_benchmark_request_index().await?;
@@ -297,9 +297,9 @@ async fn cron_enqueue_jobs(site_ctxt: &Arc<SiteCtxt>) -> anyhow::Result<()> {
297297
Ok(())
298298
}
299299

300-
/// Entry point for the cron
301-
pub async fn cron_main(site_ctxt: Arc<RwLock<Option<Arc<SiteCtxt>>>>, seconds: u64) {
302-
let mut interval = time::interval(Duration::from_secs(seconds));
300+
/// Entry point for the cron job that manages the benchmark request and job queue.
301+
pub async fn cron_main(site_ctxt: Arc<RwLock<Option<Arc<SiteCtxt>>>>, run_interval: Duration) {
302+
let mut interval = time::interval(run_interval);
303303
let ctxt = site_ctxt.clone();
304304

305305
loop {
@@ -484,7 +484,7 @@ mod tests {
484484
create_master("mmm", "aaa", 18),
485485
];
486486

487-
db_insert_requests(&*db, &requests).await;
487+
db_insert_requests(db, &requests).await;
488488
db.attach_shas_to_try_benchmark_request(16, "try1", "rrr", Utc::now())
489489
.await
490490
.unwrap();
@@ -496,15 +496,15 @@ mod tests {
496496
.unwrap();
497497

498498
mark_as_completed(
499-
&*db,
499+
db,
500500
&["bar", "345", "aaa", "rrr"],
501501
collector_name,
502502
benchmark_set,
503503
target,
504504
)
505505
.await;
506506

507-
let sorted: Vec<BenchmarkRequest> = build_queue(&*db).await.unwrap();
507+
let sorted: Vec<BenchmarkRequest> = build_queue(db).await.unwrap();
508508

509509
queue_order_matches(&sorted, &["try1", "v1.2.3", "123", "foo", "mmm", "baz"]);
510510
Ok(ctx)

site/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use site::job_queue::{cron_main, run_new_queue};
44
use site::load;
55
use std::env;
66
use std::sync::Arc;
7+
use std::time::Duration;
78
use tokio::task;
89

910
#[cfg(unix)]
@@ -60,7 +61,11 @@ async fn main() {
6061

6162
if run_new_queue() {
6263
task::spawn(async move {
63-
cron_main(ctxt.clone(), queue_update_interval_seconds).await;
64+
cron_main(
65+
ctxt.clone(),
66+
Duration::from_secs(queue_update_interval_seconds),
67+
)
68+
.await;
6469
});
6570
}
6671

0 commit comments

Comments
 (0)