PRWelBot4SECourse/main.py

33 lines
740 B
Python
Raw Normal View History

2023-03-28 15:43:44 +08:00
#!/usr/bin/python
# 项目主函数入口
import datetime
import time
from commons.logUtil import logger
from controllers.prController import app
from services.pullService import check_and_update_pull
from threading import Thread
import config.baseConfig as baseConfig
2023-12-07 11:26:29 +08:00
# 监测函数
2023-03-28 15:43:44 +08:00
def monitoring_loop():
while True:
check_and_update_pull()
now = datetime.datetime.now()
logger.info('执行定时任务 :' + now.strftime('%Y-%m-%d %H:%M:%S'))
time.sleep(600)
2023-12-07 11:26:29 +08:00
# 程序执行入口
2023-03-28 15:43:44 +08:00
def run():
2023-12-07 11:26:29 +08:00
#开启监测进程
2023-03-28 15:43:44 +08:00
monitoring_thread = Thread(target=monitoring_loop)
monitoring_thread.start()
app.run(host=baseConfig.host, port=baseConfig.port)
if __name__ == '__main__':
run()