added healthcheck ping retry logic
This commit is contained in:
parent
af88f9de6e
commit
94d00b4c45
@ -29,7 +29,11 @@ def main() -> None:
|
|||||||
container = client.containers.get(container_id)
|
container = client.containers.get(container_id)
|
||||||
container_status = container.attrs["State"]["Status"]
|
container_status = container.attrs["State"]["Status"]
|
||||||
if container_status in ["healthy", "running"]:
|
if container_status in ["healthy", "running"]:
|
||||||
requests.post(checks[container_id])
|
retry_count = 0
|
||||||
|
while requests.post(checks[container_id]).content != b'OK':
|
||||||
|
if retry_count > 10:
|
||||||
|
print(f"error posting to '{container_id}' with url '{checks[container_id]}'")
|
||||||
|
retry_count += 1
|
||||||
else:
|
else:
|
||||||
requests.post(
|
requests.post(
|
||||||
checks[container_id] + "/fail",
|
checks[container_id] + "/fail",
|
||||||
|
Loading…
Reference in New Issue
Block a user