File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -368,16 +368,11 @@ fn wait_for_termination(
368368 drop ( cvar. wait_while ( lck. lock ( ) . unwrap ( ) , |finish| !* finish) ) ;
369369
370370 // context is unlocked here so locking it again in other thread that is blocking current_pid is safe.
371-
372- match * current_pid. lock ( ) . unwrap ( ) {
373- Some ( pid) => {
374- info ! ( pid = pid, msg = "stopping supervisor process" ) ;
375- _ = ProcessTerminator :: new ( pid)
376- . shutdown ( || wait_exit_timeout_default ( shutdown_ctx) ) ;
377- }
378- _ => {
379- info ! ( msg = "stopped supervisor without process running" ) ;
380- }
371+ if let Some ( pid) = * current_pid. lock ( ) . unwrap ( ) {
372+ info ! ( %pid, msg = "stopping supervisor process" ) ;
373+ _ = ProcessTerminator :: new ( pid) . shutdown ( || wait_exit_timeout_default ( shutdown_ctx) ) ;
374+ } else {
375+ info ! ( msg = "stopped supervisor without process running" ) ;
381376 }
382377 } )
383378}
Original file line number Diff line number Diff line change @@ -204,15 +204,15 @@ where
204204 // TODO: we need to refactor the supervisor-assembler components in order to avoid persisting
205205 // and restarting the supervisor until the supervisor corresponding to the new configuration
206206 // is successfully.
207- match self . store_config_hash_and_values( & config, & yaml_config) { Err ( err ) => {
207+ if let Err ( err ) = self . store_config_hash_and_values( & config, & yaml_config) {
208208 warn!( hash=& config. hash. get( ) , "Persisting remote configuration failed: {err}" ) ;
209209 self . report_config_status( & config, opamp_client, OpampRemoteConfigStatus :: Error ( err. to_string( ) ) ) ;
210- } _ => {
210+ } else {
211211 // We need to restart the supervisor after we receive a new config
212212 // as we don't have hot-reloading handling implemented yet
213213 stop_supervisor( supervisor) ;
214214 supervisor = self . assemble_and_start_supervisor( ) ;
215- } }
215+ }
216216 }
217217 }
218218 } ,
Original file line number Diff line number Diff line change @@ -10,13 +10,10 @@ where
1010{
1111 let mut last_err = Ok ( ( ) ) ;
1212 for _ in 0 ..max_attempts {
13- match f ( ) {
14- Err ( err) => last_err = Err ( err) ,
15- _ => {
16- return ;
17- }
18- }
19- std:: thread:: sleep ( interval) ;
13+ if let Err ( err) = f ( ) {
14+ last_err = Err ( err) ;
15+ std:: thread:: sleep ( interval) ;
16+ } ;
2017 }
2118 last_err. unwrap_or_else ( |err| panic ! ( "retry failed after {max_attempts} attempts: {err}" ) )
2219}
Original file line number Diff line number Diff line change 99{
1010 let mut last_err = Ok ( ( ) ) ;
1111 for _ in 0 ..max_attempts {
12- match f ( ) {
13- Err ( err) => last_err = Err ( err) ,
14- _ => {
15- return ;
16- }
12+ if let Err ( err) = f ( ) {
13+ last_err = Err ( err) ;
14+ std:: thread:: sleep ( interval) ;
1715 }
18- std:: thread:: sleep ( interval) ;
1916 }
2017 last_err. unwrap_or_else ( |err| panic ! ( "retry failed after {max_attempts} attempts: {err}" ) )
2118}
You can’t perform that action at this time.
0 commit comments