Commit 4a013be
committed
fix(serve): guard against None 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, so MetricsManager should not trigger a
scaled-to-zero optimised push.
Signed-off-by: chenshi5012 <chenshi5012@163.com>1 parent 35629a8 commit 4a013be
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
799 | 805 | | |
800 | 806 | | |
801 | | - | |
| 807 | + | |
802 | 808 | | |
803 | 809 | | |
804 | 810 | | |
| |||
0 commit comments