Skip to content

Commit b0b88c7

Browse files
fixed kv router issue
1 parent 6835dd7 commit b0b88c7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/llm/components/kv_router.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ def _update_and_get_active_blocks(self, worker_id: str, polled_value: int) -> in
185185
This allows the router to account for requests that have been dispatched but
186186
not yet reflected in the polled metrics.
187187
"""
188+
# Initialize if worker_id is not present
189+
if worker_id not in self.active_blocks_dict:
190+
self.active_blocks_dict[worker_id] = [polled_value, polled_value]
191+
return polled_value
192+
188193
old_value, predictive_value = self.active_blocks_dict[worker_id]
189194

190195
# Check if polled value is different from old value

0 commit comments

Comments
 (0)