sleep after getting the lock

This commit is contained in:
Alex 2025-01-09 17:43:19 +03:00
parent b1b06b2e51
commit 40a92932a2

View file

@ -18,8 +18,8 @@ async def handler():
Checks for new alerts, sends them in 10 seconds Checks for new alerts, sends them in 10 seconds
""" """
alert_counts: list[list] = [] alert_counts: list[list] = []
await asyncio.sleep(10)
async with handler_lock: async with handler_lock:
await asyncio.sleep(10)
alert_files = [f for f in os.listdir(str(TMP_DIR)) if f.startswith("alert-")] alert_files = [f for f in os.listdir(str(TMP_DIR)) if f.startswith("alert-")]
for fname in alert_files: for fname in alert_files:
fpath = str(TMP_DIR / fname) fpath = str(TMP_DIR / fname)