@@ -130,7 +130,7 @@ def run_watcher_loop(check_interval: float) -> None:
130130 signal .signal (signal .SIGINT , signal_handler )
131131
132132 consecutive_empty_checks = 0
133- max_empty_checks = 3
133+ max_empty_checks = 30
134134
135135 try :
136136 while True :
@@ -161,38 +161,6 @@ def run_watcher_loop(check_interval: float) -> None:
161161 logger .info ("🔍 Evaluation watcher stopped" )
162162
163163
164- def _watcher_process_target (check_interval : float ) -> None :
165- """Target function for the watcher process."""
166- try :
167- # Detach from parent process group to become independent
168- try :
169- os .setsid ()
170- except OSError :
171- # On Windows or if already detached, this might fail
172- pass
173-
174- # Try to acquire the lock
175- current_holder_pid = acquire_singleton_lock (get_eval_protocol_dir (), LOCK_NAME )
176-
177- if current_holder_pid is not None :
178- # Another process is already running
179- logger .info (f"🔍 Evaluation watcher already running in process { current_holder_pid } " )
180- return
181-
182- # We acquired the lock, run the watcher loop
183- try :
184- run_watcher_loop (check_interval )
185- except SystemExit :
186- # Graceful shutdown
187- pass
188- finally :
189- # Always release the lock when we exit
190- release_singleton_lock (get_eval_protocol_dir (), LOCK_NAME )
191-
192- except Exception as e :
193- logger .error (f"❌ Error in watcher process: { e } " )
194-
195-
196164def _start_watcher_process (check_interval : float ) -> Optional [int ]:
197165 """Start the watcher in a completely independent background process using subprocess.
198166
0 commit comments