repeating food download if error occurred on first try
Signed-off-by: klux2 <k.lux.gm@gmail.com>
This commit is contained in:
parent
29220fa2c5
commit
337d4d15f8
1 changed files with 6 additions and 1 deletions
|
@ -368,7 +368,7 @@ def shutdown(signum, frame):
|
||||||
|
|
||||||
|
|
||||||
async def essen_loop() -> None:
|
async def essen_loop() -> None:
|
||||||
global status, essen, ids
|
global status, essen, ids, var
|
||||||
while True:
|
while True:
|
||||||
now = datetime.datetime.today()
|
now = datetime.datetime.today()
|
||||||
next_day = datetime.datetime(now.year, now.month, now.day) + datetime.timedelta(1, 36000)
|
next_day = datetime.datetime(now.year, now.month, now.day) + datetime.timedelta(1, 36000)
|
||||||
|
@ -378,6 +378,11 @@ async def essen_loop() -> None:
|
||||||
await send_status("Aufwachen um 10 Uhr")
|
await send_status("Aufwachen um 10 Uhr")
|
||||||
status = "Essen abrufen"
|
status = "Essen abrufen"
|
||||||
await get_essen(True)
|
await get_essen(True)
|
||||||
|
# try again if error
|
||||||
|
if len(essen) == 0 and var:
|
||||||
|
await send_status("Fehler, warte 30 Sekunden")
|
||||||
|
await asyncio.sleep(30)
|
||||||
|
await get_essen(True)
|
||||||
await send_status("%i Essen gefunden" % len(essen))
|
await send_status("%i Essen gefunden" % len(essen))
|
||||||
status = "Essen senden"
|
status = "Essen senden"
|
||||||
if len(essen) > 0:
|
if len(essen) > 0:
|
||||||
|
|
Loading…
Reference in a new issue