File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -39,12 +39,15 @@ pub fn run(command: Command) -> Result<()> {
39
39
match command {
40
40
Command :: UpdateDownloads => {
41
41
let count: i64 = background_jobs:: table
42
- . filter ( background_jobs:: job_type. eq ( "update_downloads" ) )
42
+ . filter ( background_jobs:: job_type. eq ( jobs :: UpdateDownloads :: JOB_NAME ) )
43
43
. count ( )
44
44
. get_result ( conn) ?;
45
45
46
46
if count > 0 {
47
- println ! ( "Did not enqueue update_downloads, existing job already in progress" ) ;
47
+ println ! (
48
+ "Did not enqueue {}, existing job already in progress" ,
49
+ jobs:: UpdateDownloads :: JOB_NAME
50
+ ) ;
48
51
} else {
49
52
jobs:: UpdateDownloads . enqueue ( conn) ?;
50
53
}
Original file line number Diff line number Diff line change 7
7
#![ warn( clippy:: all, rust_2018_idioms) ]
8
8
9
9
use anyhow:: Result ;
10
+ use crates_io:: worker:: jobs;
11
+ use crates_io:: worker:: swirl:: BackgroundJob ;
10
12
use crates_io:: { admin:: on_call, db, schema:: * } ;
11
13
use crates_io_env_vars:: { var, var_parsed} ;
12
14
use diesel:: prelude:: * ;
@@ -79,7 +81,7 @@ fn check_stalled_update_downloads(conn: &mut PgConnection) -> Result<()> {
79
81
let max_job_time = var_parsed ( "MONITOR_MAX_UPDATE_DOWNLOADS_TIME" ) ?. unwrap_or ( 120 ) ;
80
82
81
83
let start_time: Result < NaiveDateTime , _ > = background_jobs:: table
82
- . filter ( background_jobs:: job_type. eq ( "update_downloads" ) )
84
+ . filter ( background_jobs:: job_type. eq ( jobs :: UpdateDownloads :: JOB_NAME ) )
83
85
. select ( background_jobs:: created_at)
84
86
. first ( conn) ;
85
87
You can’t perform that action at this time.
0 commit comments