File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 11use crate :: { docbuilder:: RustwideBuilder , utils:: report_error, BuildQueue } ;
2- use anyhow:: Error ;
2+ use anyhow:: { Context , Error } ;
33use log:: { debug, error, warn} ;
44use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
55use std:: sync:: Arc ;
@@ -18,10 +18,18 @@ pub fn queue_builder(
1818 }
1919
2020 // check lock file
21- if build_queue. is_locked ( ) ? {
22- warn ! ( "Build queue is locked, skipping building new crates" ) ;
23- thread:: sleep ( Duration :: from_secs ( 60 ) ) ;
24- continue ;
21+ match build_queue. is_locked ( ) . context ( "could not get queue lock" ) {
22+ Ok ( true ) => {
23+ warn ! ( "Build queue is locked, skipping building new crates" ) ;
24+ thread:: sleep ( Duration :: from_secs ( 60 ) ) ;
25+ continue ;
26+ }
27+ Ok ( false ) => { }
28+ Err ( err) => {
29+ report_error ( & err) ;
30+ thread:: sleep ( Duration :: from_secs ( 60 ) ) ;
31+ continue ;
32+ }
2533 }
2634
2735 // If a panic occurs while building a crate, lock the queue until an admin has a chance to look at it.
@@ -41,8 +49,8 @@ pub fn queue_builder(
4149
4250 if let Err ( e) = res {
4351 error ! ( "GRAVE ERROR Building new crates panicked: {:?}" , e) ;
44- // If we panic here something is really truly wrong and trying to handle the error won't help.
45- build_queue . lock ( ) . expect ( "failed to lock queue" ) ;
52+ thread :: sleep ( Duration :: from_secs ( 60 ) ) ;
53+ continue ;
4654 }
4755 }
4856}
You can’t perform that action at this time.
0 commit comments