PRWelBot4SECourse/main.py

33 lines
740 B
Python

#!/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
# 监测函数
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)
# 程序执行入口
def run():
#开启监测进程
monitoring_thread = Thread(target=monitoring_loop)
monitoring_thread.start()
app.run(host=baseConfig.host, port=baseConfig.port)
if __name__ == '__main__':
run()