Skip to content

Commit f620ad1

Browse files
committed
small optimization
Signed-off-by: Nick Hill <[email protected]>
1 parent 15c50f7 commit f620ad1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

vllm/v1/engine/core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,16 @@ def step_with_batch_queue(
467467
return engine_core_outputs, model_executed
468468

469469
def _process_aborts_queue(self):
470-
while not self.aborts_queue.empty():
471-
self.abort_requests(self.aborts_queue.get_nowait())
470+
if not self.aborts_queue.empty():
471+
request_ids = []
472+
while not self.aborts_queue.empty():
473+
ids = self.aborts_queue.get_nowait()
474+
if isinstance(ids, str):
475+
# Should be a list here, but also handle string just in case.
476+
ids = (ids,)
477+
request_ids.extend(ids)
478+
# More efficient to abort all as a single batch.
479+
self.abort_requests(request_ids)
472480

473481
def shutdown(self):
474482
self.structured_output_manager.clear_backend()

0 commit comments

Comments
 (0)