Skip to content

Commit

Permalink
HH-235762 add skip_empty_upstream_check_for_upstreams option
Browse files Browse the repository at this point in the history
  • Loading branch information
gtroitskiy committed Nov 6, 2024
1 parent b1fb812 commit 026ba7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontik/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class Options:
# upstream options
upstreams: list = field(default_factory=lambda: [])
fail_start_on_empty_upstream: bool = True
skip_empty_upstream_check_for_upstreams: list = field(default_factory=lambda: [])

# opentelemetry options
opentelemetry_collector_url: str = 'http://127.0.0.1:2360'
Expand Down
3 changes: 2 additions & 1 deletion frontik/service_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ def deregister_service_and_close(self) -> None:
log.info('Failed to deregister service %s normally', self.service_id)

def __check_empty_upstreams_on_startup(self) -> None:
empty_upstreams = [k for k, v in self._upstreams.items() if not v.servers]
skip_check_upstreams = options.skip_empty_upstream_check_for_upstreams
empty_upstreams = [k for k, v in self._upstreams.items() if not v.servers and k not in skip_check_upstreams]
if empty_upstreams:
msg = f'failed startup application, because for next upstreams got empty servers: {empty_upstreams}'
raise RuntimeError(msg)
Expand Down

0 comments on commit 026ba7f

Please sign in to comment.