@@ -271,15 +271,16 @@ impl Daemon {
271271
272272 let running = self . running . clone ( ) ;
273273 let data_source_clone = self . data_source . clone ( ) ;
274+ let config = config. clone ( ) ;
274275
275276 let task = tokio:: spawn ( async move {
276277 let now = SystemTime :: now ( ) ;
277278 while running. load ( Ordering :: SeqCst ) {
278279 // Perform data acquisition
279280 // This would integrate with our acquisition module
280281
281- // Example: wait 60 second between acquisitions
282- debug ! ( "Acquiring data..." ) ;
282+ // Example: wait 610 second between acquisitions
283+ debug ! ( "Acquiring data... currently simulated " ) ;
283284 // Simulate data acquisition
284285 let timestamp = SystemTime :: now ( )
285286 . duration_since ( now)
@@ -290,7 +291,7 @@ impl Daemon {
290291 ( 5678 + timestamp) as f32 ,
291292 ( 1000 + timestamp) as f32 ,
292293 ) ;
293- time:: sleep ( Duration :: from_secs ( 60 ) ) . await ;
294+ time:: sleep ( Duration :: from_secs ( config . acquisition . interval_ms / 1000 ) ) . await ;
294295 }
295296 Ok ( ( ) )
296297 } ) ;
@@ -522,8 +523,16 @@ impl Daemon {
522523 /// ```
523524 pub async fn join ( self ) -> Result < ( ) > {
524525 for task in self . tasks {
525- if let Err ( e) = task. await {
526- log:: error!( "Task panicked: {}" , e) ;
526+ match tokio:: time:: timeout ( Duration :: from_secs ( 10 ) , task) . await {
527+ Ok ( result) => {
528+ if let Err ( e) = result {
529+ log:: error!( "Task panicked: {}" , e) ;
530+ }
531+ }
532+ Err ( _) => {
533+ // Task didn't complete within timeout
534+ log:: warn!( "Task did not complete within timeout period, may be hung" ) ;
535+ }
527536 }
528537 }
529538 Ok ( ( ) )
0 commit comments