new file: app/amazon/__pycache__/del_brand.cpython-39.pyc
new file: app/amazon/__pycache__/main.cpython-39.pyc modified: app/amazon/del_brand.py modified: app/amazon/main.py modified: app/blueprints/__pycache__/main.cpython-39.pyc modified: app/blueprints/main.py modified: app/config.py modified: app/main.py new file: "app/web_source/brand-\346\227\247.html" modified: app/web_source/brand.html
This commit is contained in:
19
app/main.py
19
app/main.py
@@ -7,6 +7,7 @@ import json
|
||||
import sys
|
||||
import shutil
|
||||
import os
|
||||
from amazon.main import TaskMonitor
|
||||
os.makedirs(cache_path,exist_ok=True)
|
||||
if not debug:
|
||||
today = datetime.datetime.now().strftime("%Y_%m_%d")
|
||||
@@ -301,11 +302,29 @@ def start_flask():
|
||||
run_app(host='127.0.0.1', port=PORT)
|
||||
|
||||
|
||||
def start_task_monitor():
|
||||
"""启动任务监控器(在独立线程中运行)"""
|
||||
monitor = TaskMonitor()
|
||||
try:
|
||||
print(f"[{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] 任务监控线程已启动")
|
||||
monitor.start()
|
||||
except Exception:
|
||||
import traceback
|
||||
print(f"[{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] 任务监控线程异常退出: {traceback.format_exc()}")
|
||||
|
||||
|
||||
def main():
|
||||
if not os.path.exists(cache_path):
|
||||
os.makedirs(cache_path,exist_ok=True)
|
||||
|
||||
# 启动 Flask 服务
|
||||
t = threading.Thread(target=start_flask, daemon=True)
|
||||
t.start()
|
||||
|
||||
# 启动任务监控线程
|
||||
monitor_thread = threading.Thread(target=start_task_monitor, daemon=True)
|
||||
monitor_thread.start()
|
||||
|
||||
# 等待 Flask 启动
|
||||
time.sleep(2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user