Wait a shorter amount of time to alert up
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 5s
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 5s
This commit is contained in:
parent
446defea2c
commit
f6c74d05d3
1 changed files with 4 additions and 0 deletions
|
@ -35,6 +35,7 @@ class KumaThread(KillableThread):
|
|||
self.interval = interval
|
||||
self.kill = Event()
|
||||
self.retries = 0
|
||||
self.previous = False
|
||||
|
||||
def calculate_backoff(self) -> float:
|
||||
rnd = random.uniform(0, 1)
|
||||
|
@ -58,6 +59,7 @@ class KumaThread(KillableThread):
|
|||
url = url.replace("msg=OK", "msg=Bot%20not%20ready")
|
||||
response = client.get(url)
|
||||
response.raise_for_status()
|
||||
self.previous = bot.is_ready()
|
||||
except httpx.HTTPError as error:
|
||||
self.log.error("Failed to connect to uptime-kuma: %r: %r", url, error, exc_info=error)
|
||||
timeout = self.calculate_backoff()
|
||||
|
@ -68,6 +70,8 @@ class KumaThread(KillableThread):
|
|||
self.retries = 0
|
||||
end_time = time.time()
|
||||
timeout = self.interval - (end_time - start_time)
|
||||
if self.previous is False:
|
||||
timeout = 10
|
||||
self.kill.wait(timeout)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue