|
31 | 31 | RPCRequestException, |
32 | 32 | convert_rpc_exception_to_proto, |
33 | 33 | ) |
34 | | -from snuba.web.rpc.storage_routing.defaults import get_default_routing_decision |
35 | 34 | from snuba.web.rpc.storage_routing.load_retriever import get_cluster_loadinfo |
36 | 35 | from snuba.web.rpc.storage_routing.routing_strategies.storage_routing import ( |
37 | 36 | RoutingContext, |
@@ -135,7 +134,6 @@ class RPCEndpoint(Generic[Tin, Tout], metaclass=RegisteredClass): |
135 | 134 | def __init__(self, metrics_backend: MetricsBackend | None = None) -> None: |
136 | 135 | self._timer = Timer("endpoint_timing") |
137 | 136 | self._metrics_backend = metrics_backend or environment.metrics |
138 | | - self.routing_decision = get_default_routing_decision(None) |
139 | 137 |
|
140 | 138 | @classmethod |
141 | 139 | def request_class(cls) -> Type[Tin]: |
@@ -193,7 +191,7 @@ def execute(self, in_msg: Tin) -> Tout: |
193 | 191 | span = scope.span |
194 | 192 | if span is not None: |
195 | 193 | span.description = self.config_key() |
196 | | - self.routing_decision.routing_context = RoutingContext(timer=self._timer, in_msg=in_msg) |
| 194 | + self.routing_context = RoutingContext(timer=self._timer, in_msg=in_msg) |
197 | 195 |
|
198 | 196 | self.__before_execute(in_msg) |
199 | 197 | error: Exception | None = None |
@@ -265,13 +263,8 @@ def __before_execute(self, in_msg: Tin) -> None: |
265 | 263 | if state.get_config("storage_routing.enable_get_cluster_loadinfo", True): |
266 | 264 | get_cluster_loadinfo() |
267 | 265 |
|
268 | | - selected_strategy = RoutingStrategySelector().select_routing_strategy( |
269 | | - self.routing_decision.routing_context |
270 | | - ) |
271 | | - self.routing_decision.strategy = selected_strategy |
272 | | - self.routing_decision = selected_strategy.get_routing_decision( |
273 | | - self.routing_decision.routing_context |
274 | | - ) |
| 266 | + selected_strategy = RoutingStrategySelector().select_routing_strategy(self.routing_context) |
| 267 | + self.routing_decision = selected_strategy.get_routing_decision(self.routing_context) |
275 | 268 | self._timer.mark("rpc_start") |
276 | 269 | self._before_execute(in_msg) |
277 | 270 |
|
|
0 commit comments