对main.py文件修改注释

This commit is contained in:
ljq23 2023-12-01 10:53:14 +08:00
parent 020b3675a4
commit 87c3d5b84d
1 changed files with 11 additions and 2 deletions

13
main.py
View File

@ -10,21 +10,30 @@ import config.baseConfig as baseConfig
def monitoring_loop(): def monitoring_loop():
# 无限循环,用于定时任务监控
while True: while True:
# 检查并更新拉取操作
check_and_update_pull() check_and_update_pull()
# 获取当前时间
now = datetime.datetime.now() now = datetime.datetime.now()
# 记录定时任务执行信息到日志
logger.info('执行定时任务 :' + now.strftime('%Y-%m-%d %H:%M:%S')) logger.info('执行定时任务 :' + now.strftime('%Y-%m-%d %H:%M:%S'))
# 休眠10分钟继续下一轮监控
time.sleep(600) time.sleep(600)
def run(): def run():
# 创建并启动监控线程
monitoring_thread = Thread(target=monitoring_loop) monitoring_thread = Thread(target=monitoring_loop)
monitoring_thread.start() monitoring_thread.start()
# 运行应用,指定主机和端口
app.run(host=baseConfig.host, port=baseConfig.port) app.run(host=baseConfig.host, port=baseConfig.port)
if __name__ == '__main__': if __name__ == '__main__':
# 当脚本直接运行时调用run()函数
run() run()