Skip to content

Commit ccb7eb5

Browse files
committed
Refactor services:health to use Client for health checks
1 parent dc38ecd commit ccb7eb5

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/shellsmith/services.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import httpx
44

5-
from shellsmith import api
5+
from shellsmith import Client, api
66
from shellsmith.config import config
77
from shellsmith.extract import collect_submodel_ids
88

@@ -133,15 +133,8 @@ def health(timeout: float = 0.1, host: str = config.host) -> str:
133133
Returns:
134134
"UP" if the service is reachable, otherwise "DOWN".
135135
"""
136-
url = f"{host}/actuator/health"
137-
138-
try:
139-
response = httpx.get(url, timeout=timeout)
140-
response.raise_for_status()
141-
data = response.json()
142-
return data["status"]
143-
except httpx.RequestError:
144-
return "DOWN"
136+
with Client(host=host) as client:
137+
client.get_health_status()
145138

146139

147140
def find_unreferenced_submodels(host: str = config.host) -> list[str]:

0 commit comments

Comments
 (0)