fix(auth): 在请求上下文中添加会话ID设置

feat(gencode): 改进导入验证错误信息格式

fix(scheduler): 修复任务重复添加问题并合并错过的任务

refactor(router): 优化路由转换逻辑避免Layout嵌套

feat(middleware): 增强会话ID提取功能并改进日志记录
This commit is contained in:
zhangtao
2025-12-05 00:19:44 +08:00
parent 7cbcbf73f8
commit b2e0a3d9c4
6 changed files with 99 additions and 14 deletions
@@ -44,7 +44,7 @@ executors = {
}
# 配置默认参数
job_defaults = {
'coalesce': False, # 是否合并执行
'coalesce': True, # 合并执行错过的任务
'max_instances': 1, # 最大实例数
}
# 配置调度器
@@ -166,7 +166,11 @@ class SchedulerUtil:
job_list = await JobCRUD(auth).get_obj_list_crud()
for item in job_list:
cls.remove_job(job_id=item.id) # 删除旧任务
cls.add_job(item)
# 检查任务是否已经存在
existing_job = cls.get_job(job_id=item.id)
if not existing_job:
# 任务不存在才添加
cls.add_job(item)
# 根据数据库中保存的状态来设置任务状态
if hasattr(item, 'status') and item.status == "1":
# 如果任务状态为暂停,则立即暂停刚添加的任务