Fix loop sleep timing
This commit is contained in:
parent
24ff4e69a2
commit
420976aa90
1 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,7 @@ async def remove(bot: Snake) -> None:
|
||||||
"""
|
"""
|
||||||
logger.debug("Starting Task-remove")
|
logger.debug("Starting Task-remove")
|
||||||
while True:
|
while True:
|
||||||
max_ts = datetime.now(tz=timezone.utc) + timedelta(minutes=1)
|
max_ts = datetime.now(tz=timezone.utc) + timedelta(seconds=45)
|
||||||
temproles = Temprole.find(q(expires_at__lte=max_ts, id__nin=queue))
|
temproles = Temprole.find(q(expires_at__lte=max_ts, id__nin=queue))
|
||||||
async for temprole in temproles:
|
async for temprole in temproles:
|
||||||
if temprole.id in queue:
|
if temprole.id in queue:
|
||||||
|
@ -62,5 +62,5 @@ async def remove(bot: Snake) -> None:
|
||||||
when = temprole.expires_at
|
when = temprole.expires_at
|
||||||
asyncio.create_task(runat(when, coro, logger))
|
asyncio.create_task(runat(when, coro, logger))
|
||||||
queue.append(temprole.id)
|
queue.append(temprole.id)
|
||||||
# Check every hour
|
# Check every minute
|
||||||
await asyncio.sleep(3600)
|
await asyncio.sleep(60)
|
||||||
|
|
Loading…
Add table
Reference in a new issue