mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
siso: rarely, call to getresponse can also throw.
Cover it in try so that clients don't have to deal with fatal error. Bug: b/455433899 Change-Id: Icd07e2057da19650a11981a8672c0e4c6a6a6964 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7409014 Auto-Submit: Alex Ovsienko <ovsienko@google.com> Reviewed-by: Junji Watanabe <jwata@google.com> Commit-Queue: Alex Ovsienko <ovsienko@google.com>
This commit is contained in:
9
siso.py
9
siso.py
@@ -141,9 +141,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
|
||||
conn = http.client.HTTPConnection(f"localhost:{_OTLP_HEALTH_PORT}")
|
||||
try:
|
||||
conn.request("GET", "/health/status")
|
||||
response = conn.getresponse()
|
||||
except ConnectionError:
|
||||
return Status.DEAD
|
||||
response = conn.getresponse()
|
||||
|
||||
if response.status != 200:
|
||||
return Status.DEAD
|
||||
@@ -163,8 +163,11 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
|
||||
return Status.HEALTHY
|
||||
|
||||
def fetch_receiver_endpoint(conn: http.client.HTTPConnection) -> str:
|
||||
conn.request("GET", "/health/config")
|
||||
response = conn.getresponse()
|
||||
try:
|
||||
conn.request("GET", "/health/config")
|
||||
response = conn.getresponse()
|
||||
except ConnectionError:
|
||||
return ""
|
||||
resp_json = json.loads(response.read())
|
||||
try:
|
||||
return resp_json["receivers"]["otlp"]["protocols"]["grpc"][
|
||||
|
||||
Reference in New Issue
Block a user