diff --git a/python/sglang/srt/managers/scheduler.py b/python/sglang/srt/managers/scheduler.py index 69705dc72..573627ecd 100644 --- a/python/sglang/srt/managers/scheduler.py +++ b/python/sglang/srt/managers/scheduler.py @@ -3862,6 +3862,9 @@ class Scheduler( def on_idle(self): """Idle housekeeping: guard, check, metrics, reset, sleep.""" + # Flush any health-check signal deferred while the engine was busy. + self.maybe_send_health_check_signal() + if not self.is_fully_idle(): return @@ -3921,6 +3924,14 @@ class Scheduler( # Waiting queues: waiting + bootstrapping + preallocation + kv transfer (decode) idle &= len(self.waiting_queue) == 0 + if ( + for_health_check + and not self._engine_paused + and self.disaggregation_mode == DisaggregationMode.DECODE + and self.disagg_decode_prealloc_queue is not None + ): + idle &= len(self.disagg_decode_prealloc_queue.retracted_queue) == 0 + if not for_health_check: # Grammar queue and prefill inflight queue may not produce batch # results instantly, but they still indicate the server is not idle.