Skip to content

Commit

Permalink
HH-237393 service discovery: use force_allow_cross_datacenter_for_ups…
Browse files Browse the repository at this point in the history
…treams
  • Loading branch information
gtroitskiy committed Nov 11, 2024
1 parent 2d78c9f commit f7b6533
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontik/service_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,13 @@ def __init__(self, statsd_client: Union[StatsDClient, StatsDClientStub], app_nam
upstream_cache.start()

allow_cross_dc = http_options.http_client_allow_cross_datacenter_requests
datacenters = http_options.datacenters if allow_cross_dc else (http_options.datacenter,)
for upstream, dc in itertools.product(options.upstreams, datacenters):
forced_cross_dc_upstreams = http_options.force_allow_cross_datacenter_for_upstreams

def cross_dc_or_forced(entry):
upstream, dc = entry
return allow_cross_dc or dc == http_options.datacenter or upstream not in forced_cross_dc_upstreams

for upstream, dc in itertools.filter(cross_dc_or_forced, itertools.product(options.upstreams, http_options.datacenter)):
health_cache = HealthCache(
service=upstream,
health_client=self.consul.health,
Expand Down

0 comments on commit f7b6533

Please sign in to comment.