Релиз

This commit is contained in:
Dev PC
2025-08-14 00:08:09 +03:00
parent 1c029bfd56
commit 9173211772
+3 -14
View File
@@ -54,19 +54,6 @@ async def ami_listening():
conn_check_task = asyncio.create_task(check_connection())
conn_check_task.add_done_callback(lambda t: ami_listening() if t.result() else None)
# запуск check_pending ежедневно в 23:00
async def daily_check_pending():
while True:
now = datetime.now()
if now.hour == 23 and now.minute == 0 and now.second < 5:
logging.info("Checking pending calls...")
await callhandler.check_pending()
await asyncio.sleep(60)
else:
await asyncio.sleep(1)
daily_check_pending_task = asyncio.create_task(daily_check_pending())
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -96,10 +83,12 @@ async def ami_listening():
await callhandler.handle_event(event)
if config.DEBUG:
await full_log(event)
if callhandler.date != datetime.now().date():
await callhandler.check_pending()
callhandler.check_date()
except (KeyboardInterrupt, SystemExit):
logging.info("Exiting...")
s.close()
daily_check_pending_task.cancel()
except ConnectionResetError:
logging.warning("Connection reset. Restarting...")
await ami_listening()