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<()> {
3939 match command {
4040 Command :: UpdateDownloads => {
4141 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 ) )
4343 . count ( )
4444 . get_result ( conn) ?;
4545
4646 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+ ) ;
4851 } else {
4952 jobs:: UpdateDownloads . enqueue ( conn) ?;
5053 }
Original file line number Diff line number Diff line change 77#![ warn( clippy:: all, rust_2018_idioms) ]
88
99use anyhow:: Result ;
10+ use crates_io:: worker:: jobs;
11+ use crates_io:: worker:: swirl:: BackgroundJob ;
1012use crates_io:: { admin:: on_call, db, schema:: * } ;
1113use crates_io_env_vars:: { var, var_parsed} ;
1214use diesel:: prelude:: * ;
@@ -79,7 +81,7 @@ fn check_stalled_update_downloads(conn: &mut PgConnection) -> Result<()> {
7981 let max_job_time = var_parsed ( "MONITOR_MAX_UPDATE_DOWNLOADS_TIME" ) ?. unwrap_or ( 120 ) ;
8082
8183 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 ) )
8385 . select ( background_jobs:: created_at)
8486 . first ( conn) ;
8587
You can’t perform that action at this time.
0 commit comments