Skip to content

Commit

Permalink
Hot fix incorrect change to cancel function (#79)
Browse files Browse the repository at this point in the history
Restore original cancel code
  • Loading branch information
masahi authored Nov 22, 2023
1 parent 28422a1 commit dc928f9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions serve/mlc_serve/engine/staging_engine_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,20 @@ def add(self, request_states: list[RequestState]):
self.queue.extend(valid_states)
self.has_new_requests.notify_all()

def _get_request_state(self, request_id: RequestId) -> Optional[RequestState]:
for state in self.queue:
if state.request_id == request_id:
return state

return None

def _cacnel_or_stop_request(
self, request_id: RequestId, requests: list[RequestState]
):
with self.queue_lock:
state = self._get_request_state(request_id)
if state:
del state
queue_index_to_delete = None
for i, state in enumerate(self.queue):
if state.request_id == request_id:
queue_index_to_delete = i
requests.append(state)
break

if queue_index_to_delete is not None:
del self.queue[queue_index_to_delete]

if request_id in self.current_batch:
requests.append(self.current_batch[request_id])
Expand Down

0 comments on commit dc928f9

Please sign in to comment.