-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgarbage_collector_main.py
64 lines (55 loc) · 2.46 KB
/
garbage_collector_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from src.utils import seprate_admins
from decouple import config
from garbage_collector import GarbageCollector
from src.db import DB
import schedule
import time
def update_user_records():
garbage_collector.update_user_records()
garbage_collector.update_ranks()
def clear_forget_codes():
garbage_collector.clear_forget_codes()
garbage_collector = GarbageCollector(
token=config('TOKEN'),
admin_ids=seprate_admins(config('ADMIN_ID')),
log_level=config('LOG_LEVEL', default='INFO'),
db=DB(
host=config('DB_HOST', default='127.0.0.1'),
port=config('DB_PORT', default='27017')
),
)
schedule.every().day.at("22:00").do(update_user_records)
schedule.every().day.at("01:00").do(update_user_records)
schedule.every().day.at("02:00").do(update_user_records)
schedule.every().day.at("02:30").do(update_user_records)
schedule.every().day.at("03:00").do(update_user_records)
schedule.every().day.at("03:30").do(update_user_records)
schedule.every().day.at("04:00").do(update_user_records)
schedule.every().day.at("04:30").do(update_user_records)
schedule.every().day.at("05:00").do(update_user_records)
schedule.every().day.at("05:30").do(update_user_records)
schedule.every().day.at("06:00").do(update_user_records)
schedule.every().day.at("06:30").do(update_user_records)
schedule.every().day.at("06:45").do(update_user_records)
schedule.every().day.at("07:00").do(update_user_records)
schedule.every().day.at("07:15").do(update_user_records)
schedule.every().day.at("07:30").do(update_user_records)
schedule.every().day.at("07:45").do(update_user_records)
schedule.every().day.at("08:00").do(update_user_records)
schedule.every().day.at("08:15").do(update_user_records)
schedule.every().day.at("08:30").do(update_user_records)
schedule.every().day.at("08:45").do(update_user_records)
schedule.every().day.at("09:00").do(update_user_records)
schedule.every().day.at("09:30").do(update_user_records)
schedule.every().day.at("10:00").do(update_user_records)
schedule.every().day.at("10:30").do(update_user_records)
schedule.every().day.at("11:00").do(update_user_records)
schedule.every().day.at("11:30").do(update_user_records)
schedule.every().day.at("12:00").do(update_user_records)
schedule.every().day.at("12:30").do(update_user_records)
schedule.every().day.at("15:00").do(clear_forget_codes)
while True:
garbage_collector.update_user_records()
garbage_collector.update_ranks()
schedule.run_pending()
time.sleep(15 * 60)