@@ -371,8 +371,6 @@ impl RemoteConfigClientWorker {
371371 }
372372
373373 async fn run_loop ( self ) {
374- let poll_interval = Duration :: from_secs_f64 ( self . config . remote_config_poll_interval ( ) ) ;
375-
376374 let registry = match ParserRegistry :: new ( ) . with :: < ApmTracingConfig > ( ) {
377375 Ok ( r) => r,
378376 Err ( e) => {
@@ -403,17 +401,21 @@ impl RemoteConfigClientWorker {
403401
404402 let mut fetcher = SingleChangesFetcher :: new ( storage, target, runtime_id, options) ;
405403
406- loop {
407- fetcher. set_extra_services ( self . config . get_extra_services ( ) ) ;
408-
409- match fetcher. fetch_changes ( ) . await {
410- Ok ( changes) => apply_changes ( changes, & self . config , & fetcher) ,
411- Err ( e) => crate :: dd_debug!( "RemoteConfigClient: fetch failed: {}" , e) ,
412- }
404+ let mut poll_interval = tokio:: time:: interval ( Duration :: from_secs_f64 (
405+ self . config . remote_config_poll_interval ( ) ,
406+ ) ) ;
407+ poll_interval. set_missed_tick_behavior ( tokio:: time:: MissedTickBehavior :: Delay ) ;
413408
409+ loop {
414410 tokio:: select! {
415411 _ = self . shutdown_receiver. cancel_token. cancelled( ) => break ,
416- _ = tokio:: time:: sleep( poll_interval) => { }
412+ _ = poll_interval. tick( ) => {
413+ fetcher. set_extra_services( self . config. get_extra_services( ) ) ;
414+ match fetcher. fetch_changes( ) . await {
415+ Ok ( changes) => apply_changes( changes, & self . config, & fetcher) ,
416+ Err ( e) => crate :: dd_debug!( "RemoteConfigClient: fetch failed: {}" , e) ,
417+ }
418+ }
417419 }
418420 }
419421 }
0 commit comments