PRWelBot4SECourse/main.py

32 lines
681 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()