@@ -210,48 +210,51 @@ impl RecordProgressThread {
210
210
in_flight_requests,
211
211
} ;
212
212
let ret = this. clone ( ) ;
213
- std:: thread:: spawn ( move || loop {
214
- // Panics should already be logged and otherwise there's not much we
215
- // can/should do.
216
- let _ = std:: panic:: catch_unwind ( std:: panic:: AssertUnwindSafe ( || {
217
- let result = rx. recv ( ) . unwrap ( ) ;
218
- this. block_until_idle ( ) ;
219
-
220
- let start = std:: time:: Instant :: now ( ) ;
221
-
222
- if let Some ( ex) = Experiment :: get ( & db, & result. experiment_name ) . unwrap ( ) {
223
- let db = DatabaseDB :: new ( & db) ;
224
- if let Err ( e) = db. store ( & ex, & result. data , EncodingType :: Plain ) {
225
- // Failing to record a result is basically fine -- this
226
- // just means that we'll have to re-try this job.
227
- log:: error!( "Failed to store result into database: {:?}" , e) ;
228
- crate :: utils:: report_failure ( & e) ;
213
+ std:: thread:: Builder :: new ( )
214
+ . name ( String :: from ( "record-prog-crater" ) )
215
+ . spawn ( move || loop {
216
+ // Panics should already be logged and otherwise there's not much we
217
+ // can/should do.
218
+ let _ = std:: panic:: catch_unwind ( std:: panic:: AssertUnwindSafe ( || {
219
+ let result = rx. recv ( ) . unwrap ( ) ;
220
+ this. block_until_idle ( ) ;
221
+
222
+ let start = std:: time:: Instant :: now ( ) ;
223
+
224
+ if let Some ( ex) = Experiment :: get ( & db, & result. experiment_name ) . unwrap ( ) {
225
+ let db = DatabaseDB :: new ( & db) ;
226
+ if let Err ( e) = db. store ( & ex, & result. data , EncodingType :: Plain ) {
227
+ // Failing to record a result is basically fine -- this
228
+ // just means that we'll have to re-try this job.
229
+ log:: error!( "Failed to store result into database: {:?}" , e) ;
230
+ crate :: utils:: report_failure ( & e) ;
231
+ }
232
+
233
+ metrics. record_completed_jobs ( & ex. name , 1 ) ;
234
+
235
+ if let Err ( e) = db. clear_stale_records ( ) {
236
+ // Not a hard failure. We can continue even if we failed
237
+ // to clear records from already completed runs...
238
+ log:: error!( "Failed to clear stale records: {:?}" , e) ;
239
+ crate :: utils:: report_failure ( & e) ;
240
+ }
241
+
242
+ metrics
243
+ . crater_endpoint_time
244
+ . with_label_values ( & [ "record_progress_worker" ] )
245
+ . observe ( start. elapsed ( ) . as_secs_f64 ( ) ) ;
246
+
247
+ metrics
248
+ . crater_progress_report
249
+ . with_label_values ( & [
250
+ ex. name . as_str ( ) ,
251
+ & result. data . result . result . to_string ( ) ,
252
+ ] )
253
+ . inc ( ) ;
229
254
}
230
-
231
- metrics. record_completed_jobs ( & ex. name , 1 ) ;
232
-
233
- if let Err ( e) = db. clear_stale_records ( ) {
234
- // Not a hard failure. We can continue even if we failed
235
- // to clear records from already completed runs...
236
- log:: error!( "Failed to clear stale records: {:?}" , e) ;
237
- crate :: utils:: report_failure ( & e) ;
238
- }
239
-
240
- metrics
241
- . crater_endpoint_time
242
- . with_label_values ( & [ "record_progress_worker" ] )
243
- . observe ( start. elapsed ( ) . as_secs_f64 ( ) ) ;
244
-
245
- metrics
246
- . crater_progress_report
247
- . with_label_values ( & [
248
- ex. name . as_str ( ) ,
249
- & result. data . result . result . to_string ( ) ,
250
- ] )
251
- . inc ( ) ;
252
- }
253
- } ) ) ;
254
- } ) ;
255
+ } ) ) ;
256
+ } )
257
+ . unwrap ( ) ;
255
258
256
259
ret
257
260
}
0 commit comments