@@ -22,7 +22,7 @@ pub fn run_new_queue() -> bool {
22
22
/// Store the latest master commits or do nothing if all of them are
23
23
/// already in the database
24
24
async fn create_benchmark_request_master_commits (
25
- ctxt : & Arc < SiteCtxt > ,
25
+ ctxt : & SiteCtxt ,
26
26
conn : & dyn database:: pool:: Connection ,
27
27
index : & BenchmarkRequestIndex ,
28
28
) -> anyhow:: Result < ( ) > {
@@ -282,7 +282,7 @@ async fn process_benchmark_requests(
282
282
}
283
283
284
284
/// 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 < ( ) > {
286
286
let mut conn = site_ctxt. conn ( ) . await ;
287
287
288
288
let index = conn. load_benchmark_request_index ( ) . await ?;
@@ -297,9 +297,9 @@ async fn cron_enqueue_jobs(site_ctxt: &Arc<SiteCtxt>) -> anyhow::Result<()> {
297
297
Ok ( ( ) )
298
298
}
299
299
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 ) ;
303
303
let ctxt = site_ctxt. clone ( ) ;
304
304
305
305
loop {
@@ -484,7 +484,7 @@ mod tests {
484
484
create_master( "mmm" , "aaa" , 18 ) ,
485
485
] ;
486
486
487
- db_insert_requests ( & * db, & requests) . await ;
487
+ db_insert_requests ( db, & requests) . await ;
488
488
db. attach_shas_to_try_benchmark_request ( 16 , "try1" , "rrr" , Utc :: now ( ) )
489
489
. await
490
490
. unwrap ( ) ;
@@ -496,15 +496,15 @@ mod tests {
496
496
. unwrap ( ) ;
497
497
498
498
mark_as_completed (
499
- & * db,
499
+ db,
500
500
& [ "bar" , "345" , "aaa" , "rrr" ] ,
501
501
collector_name,
502
502
benchmark_set,
503
503
target,
504
504
)
505
505
. await ;
506
506
507
- let sorted: Vec < BenchmarkRequest > = build_queue ( & * db) . await . unwrap ( ) ;
507
+ let sorted: Vec < BenchmarkRequest > = build_queue ( db) . await . unwrap ( ) ;
508
508
509
509
queue_order_matches ( & sorted, & [ "try1" , "v1.2.3" , "123" , "foo" , "mmm" , "baz" ] ) ;
510
510
Ok ( ctx)
0 commit comments