update pay function

This commit is contained in:
2025-11-27 11:28:57 +08:00
parent 62cf0a6c7d
commit 900aff17df
5 changed files with 1469 additions and 121 deletions

39
gunicorn_config.py Normal file
View File

@@ -0,0 +1,39 @@
# Gunicorn 配置文件
# 基本配置
bind = "0.0.0.0:5002"
workers = 4
threads = 4
timeout = 120
worker_class = "gthread"
# SSL 配置(如需要)
# certfile = "/etc/letsencrypt/live/api.valuefrontier.cn/fullchain.pem"
# keyfile = "/etc/letsencrypt/live/api.valuefrontier.cn/privkey.pem"
# 日志配置
loglevel = "info"
accesslog = "-"
errorlog = "-"
# 预加载应用(在 fork 前加载,加快 worker 启动)
preload_app = True
def on_starting(server):
"""主进程启动时调用"""
print("Gunicorn 主进程启动...")
def post_fork(server, worker):
"""Worker 进程 fork 后调用"""
print(f"Worker {worker.pid} 已启动")
def when_ready(server):
"""服务准备就绪时调用,初始化缓存"""
print("Gunicorn 服务准备就绪,开始初始化...")
from app_vx import app, init_sywg_industry_cache
with app.app_context():
init_sywg_industry_cache()
print("初始化完成!")