You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(serve): guard against NULL request_router in update_deployment_config
When AsyncioRouter.update_deployment_config() is called before the
request_router has been lazily initialised (e.g. request_router_class
is None, or the first config update arrives before any replica is
assigned), the self.request_router property returns None.
The previous code unconditionally evaluated:
len(self.request_router.curr_replicas)
which raises AttributeError: 'NoneType' object has no attribute
'curr_replicas'.
Fix: cache the property result in a local variable and fall back to 0
when it is None. Zero is semantically correct because no replicas are
active at that point.
Regression tests added in TestUpdateDeploymentConfigNullRouter:
- test_update_deployment_config_with_null_router_no_exception
- test_update_deployment_config_with_null_router_passes_zero_replicas
- test_update_deployment_config_with_initialized_router_passes_correct_count
Signed-off-by: chenshi5012 <chenshi5012@163.com>
0 commit comments