Passed
Push — master ( a8a0e7...5f5103 )
by Yohann
01:28
created

update_salaries.UpdateSalariesTask.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
import asyncio
2
from time import time
3
4
from discord.ext import tasks
5
6
from app.utils import get_last_half_hour, HALF_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_half_hour() + HALF_HOUR) - time())
16
        await asyncio.sleep((get_last_half_hour() + HALF_HOUR) - time())
17
        self.update_salaries.start()
18
19
    @tasks.loop(minutes=30)
20
    async def update_salaries(self):
21
        print('Updating salaries...')
22
        await self.manager.update_salaries()
23