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 1
1
use crate :: { docbuilder:: RustwideBuilder , utils:: report_error, BuildQueue } ;
2
- use anyhow:: Error ;
2
+ use anyhow:: { Context , Error } ;
3
3
use log:: { debug, error, warn} ;
4
4
use std:: panic:: { catch_unwind, AssertUnwindSafe } ;
5
5
use std:: sync:: Arc ;
@@ -18,10 +18,18 @@ pub fn queue_builder(
18
18
}
19
19
20
20
// 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
+ }
25
33
}
26
34
27
35
// 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(
41
49
42
50
if let Err ( e) = res {
43
51
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 ;
46
54
}
47
55
}
48
56
}
You can’t perform that action at this time.
0 commit comments