forked from Trustie-Study-Group/PRWelBot4SECourse
对main.py文件修改注释
This commit is contained in:
parent
020b3675a4
commit
87c3d5b84d
13
main.py
13
main.py
|
@ -10,21 +10,30 @@ 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'))
|
||||
|
||||
# 休眠10分钟,继续下一轮监控
|
||||
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()函数
|
||||
run()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue