File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -480,12 +480,17 @@ def handle_term(sig, frame):
480480 # Let child start writing
481481 await anyio .sleep (0.5 )
482482
483- # Verify child is writing
483+ # Verify child is writing. This can be slow/flaky under CI load, so poll up to a bounded timeout.
484484 if os .path .exists (marker_file ): # pragma: no branch
485- size1 = os .path .getsize (marker_file )
486- await anyio .sleep (0.3 )
487- size2 = os .path .getsize (marker_file )
488- assert size2 > size1 , "Child should be writing"
485+ initial_size = os .path .getsize (marker_file )
486+ deadline = anyio .current_time () + 5.0
487+ while anyio .current_time () < deadline :
488+ await anyio .sleep (0.1 )
489+ current_size = os .path .getsize (marker_file )
490+ if current_size > initial_size : # pragma: no branch
491+ break
492+ else : # pragma: no cover
493+ raise AssertionError ("Child should be writing" )
489494
490495 # Terminate - this will kill the process group even if parent exits first
491496 await _terminate_process_tree (proc )
You can’t perform that action at this time.
0 commit comments