@@ -770,12 +770,6 @@ impl MessageProcessor {
770770
771771 info ! ( "Starting window recording" ) ;
772772
773- let poll_interval_ms = if start_msg. poll_interval > 0 {
774- u64:: from ( start_msg. poll_interval )
775- } else {
776- 1000 // Default to 1000ms (1 second) if not specified.
777- } ;
778-
779773 let track_title_changes = start_msg. flags . contains ( WindowRecStartFlags :: TRACK_TITLE_CHANGE ) ;
780774
781775 // Create shutdown channel for window monitor.
@@ -786,11 +780,18 @@ impl MessageProcessor {
786780
787781 // Spawn window monitor task.
788782 let event_tx = self . io_notification_tx . clone ( ) ;
783+ let poll_interval = start_msg. poll_interval ;
789784 let window_monitor_handle = tokio:: task:: spawn ( async move {
790- let config = WindowMonitorConfig :: new ( event_tx, track_title_changes, shutdown_rx)
791- . with_poll_interval_ms ( poll_interval_ms) ;
785+ let mut config = WindowMonitorConfig :: new ( event_tx, track_title_changes, shutdown_rx) ;
792786
793- run_window_monitor ( config) . await ;
787+ // Only set custom poll interval if specified (non-zero).
788+ if poll_interval > 0 {
789+ config = config. with_poll_interval_ms ( u64:: from ( poll_interval) ) ;
790+ }
791+
792+ if let Err ( error) = run_window_monitor ( config) . await {
793+ error ! ( %error, "Window monitor failed" ) ;
794+ }
794795 } ) ;
795796
796797 self . window_monitor_handle = Some ( window_monitor_handle) ;
0 commit comments