From 6bc01ae8ff0bd8c795976e5d4d7f4edab2799b0a Mon Sep 17 00:00:00 2001 From: lda Date: Thu, 10 Sep 2026 02:16:24 +0700 Subject: [PATCH] fix: back off scheduler lock retries --- src/wf_scheduling/lifecycle.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wf_scheduling/lifecycle.py b/src/wf_scheduling/lifecycle.py index b81699f1..fc0fb846 100644 --- a/src/wf_scheduling/lifecycle.py +++ b/src/wf_scheduling/lifecycle.py @@ -516,7 +516,10 @@ class SchedulerService: cancelled = False while not self._lock.acquire(blocking=False): try: - await asyncio.sleep(0) + # The poll worker may hold this lock during file I/O. A + # nonzero delay avoids busy-spinning the event loop while + # still allowing registration and stop callbacks to run. + await asyncio.sleep(0.001) except asyncio.CancelledError: if not continue_after_cancel: raise