Fix check-alive task
This commit is contained in:
parent
eb77a84b9f
commit
e122c62ef1
1 changed files with 6 additions and 2 deletions
8
tasks.py
8
tasks.py
|
@ -64,13 +64,17 @@ def deploy(ctx: Context) -> None:
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def check_alive(ctx: Context) -> None:
|
def check_alive(ctx: Context) -> None:
|
||||||
|
exception = None
|
||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
try:
|
try:
|
||||||
res = requests.get("https://g4b.ovh/admin/")
|
res = requests.get("https://g4b.ovh/admin/")
|
||||||
res.raise_for_status()
|
res.raise_for_status()
|
||||||
except requests.exceptions.HTTPError:
|
print("Server is up & running")
|
||||||
|
return
|
||||||
|
except requests.exceptions.HTTPError as e:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return
|
exception = e
|
||||||
|
raise RuntimeError("Failed to reach the server") from exception
|
||||||
|
|
||||||
|
|
||||||
@task(pre=[check, build, publish, deploy], post=[check_alive])
|
@task(pre=[check, build, publish, deploy], post=[check_alive])
|
||||||
|
|
Loading…
Reference in a new issue