fix: resolve silent request skipping in PRIORITY scheduling (#49206)

Signed-off-by: Tejas-Raj01 <rajtejas.xyz@gmail.com>
This commit is contained in:
Tejas
2026-08-06 22:21:21 +00:00
committed by GitHub
parent a07086e403
commit 4d341ca829
2 changed files with 159 additions and 2 deletions
+10 -2
View File
@@ -593,7 +593,16 @@ class Scheduler(SchedulerInterface):
self.running,
key=lambda r: (r.priority, r.arrival_time),
)
self.running.remove(preempted_req)
# Record the index of the preemption victim to
# maintain accurate loop state.
victim_index = self.running.index(preempted_req)
del self.running[victim_index]
# Decrement the loop cursor if the removed request
# preceded the current iteration, preventing the
# silent omission of the subsequent request.
if victim_index < req_index:
req_index -= 1
if preempted_req in scheduled_running_reqs:
preempted_req_id = preempted_req.request_id
scheduled_running_reqs.remove(preempted_req)
@@ -611,7 +620,6 @@ class Scheduler(SchedulerInterface):
for i in preempted_encoder_inputs
)
encoder_compute_budget += num_embeds_to_restore
req_index -= 1
else:
preempted_req = self.running.pop()