don't healthcheck endpoints until model is loaded and benchmarks have run
This commit is contained in:
committed by
Nader Arbabian
parent
0ab9a13a46
commit
9ebf1924ea
+6
-1
@@ -60,6 +60,7 @@ class Backend:
|
||||
self.metrics = Metrics()
|
||||
self._total_pubkey_fetch_errors = 0
|
||||
self._pubkey = self._fetch_pubkey()
|
||||
self.__start_healthcheck: bool = False
|
||||
|
||||
@property
|
||||
def pubkey(self) -> Optional[RSA.RsaKey]:
|
||||
@@ -191,7 +192,10 @@ class Backend:
|
||||
if health_check_url is None:
|
||||
log.debug("No healthcheck endpoint defined, skipping healthcheck")
|
||||
return
|
||||
await sleep(5)
|
||||
while True:
|
||||
await sleep(10)
|
||||
if self.__start_healthcheck is False:
|
||||
continue
|
||||
try:
|
||||
log.debug(f"Performing healthcheck on {health_check_url}")
|
||||
async with self.session.get(health_check_url) as response:
|
||||
@@ -331,6 +335,7 @@ class Backend:
|
||||
await sleep(5)
|
||||
try:
|
||||
max_throughput = await run_benchmark()
|
||||
self.__start_healthcheck = True
|
||||
self.metrics._model_loaded(
|
||||
max_throughput=max_throughput,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user