File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ use parking_lot::RwLock;
12
12
use regex:: Regex ;
13
13
use tokio:: time:: { self , Duration } ;
14
14
15
+ pub fn run_new_queue ( ) -> bool {
16
+ std:: env:: var ( "RUN_CRON" )
17
+ . ok ( )
18
+ . and_then ( |x| x. parse ( ) . ok ( ) )
19
+ . unwrap_or ( false )
20
+ }
21
+
15
22
/// Store the latest master commits or do nothing if all of them are
16
23
/// already in the database
17
24
async fn create_benchmark_request_master_commits (
Original file line number Diff line number Diff line change 1
1
use futures:: future:: FutureExt ;
2
2
use parking_lot:: RwLock ;
3
+ use site:: job_queue:: { cron_main, run_new_queue} ;
3
4
use site:: load;
4
5
use std:: env;
5
6
use std:: sync:: Arc ;
@@ -33,10 +34,6 @@ async fn main() {
33
34
. ok ( )
34
35
. and_then ( |x| x. parse ( ) . ok ( ) )
35
36
. unwrap_or ( 30 ) ;
36
- let run_cron_job = env:: var ( "RUN_CRON" )
37
- . ok ( )
38
- . and_then ( |x| x. parse ( ) . ok ( ) )
39
- . unwrap_or ( false ) ;
40
37
41
38
let fut = tokio:: task:: spawn_blocking ( move || {
42
39
tokio:: task:: spawn ( async move {
@@ -62,9 +59,9 @@ async fn main() {
62
59
63
60
let server = site:: server:: start ( ctxt. clone ( ) , port) . fuse ( ) ;
64
61
65
- if run_cron_job {
62
+ if run_new_queue ( ) {
66
63
task:: spawn ( async move {
67
- site :: job_queue :: cron_main ( ctxt. clone ( ) , queue_update_interval_seconds) . await ;
64
+ cron_main ( ctxt. clone ( ) , queue_update_interval_seconds) . await ;
68
65
} ) ;
69
66
}
70
67
You can’t perform that action at this time.
0 commit comments