| Total Complexity | 3 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import asyncio |
||
| 2 | from time import time |
||
| 3 | |||
| 4 | from discord.ext import tasks |
||
| 5 | |||
| 6 | from app.utils import get_last_q_hour, QUARTER_HOUR |
||
| 7 | |||
| 8 | |||
| 9 | class UpdateSalariesTask: |
||
| 10 | |||
| 11 | def __init__(self, manager): |
||
| 12 | self.manager = manager |
||
| 13 | |||
| 14 | async def setup(self): |
||
| 15 | print((get_last_q_hour() + QUARTER_HOUR) - time()) |
||
| 16 | await asyncio.sleep((get_last_q_hour() + QUARTER_HOUR) - time()) |
||
| 17 | self.update_salaries.start() |
||
| 18 | |||
| 19 | @tasks.loop(minutes=QUARTER_HOUR // 60) |
||
| 20 | async def update_salaries(self): |
||
| 21 | print('Updating salaries...') |
||
| 22 | await self.manager.update_salaries() |
||
| 23 |