修复dramatiq队列无法触发钩子的问题

This commit is contained in:
jingrow 2025-11-01 01:34:52 +08:00
parent f5515ac8f3
commit bfc3883c5c

View File

@ -8,6 +8,7 @@ import dramatiq
from dramatiq.brokers.redis import RedisBroker
from jingrow.ai.pagetype.local_ai_agent.executor import NodeExecutor
from jingrow.core.hooks.init_hooks import init_hooks
logger = logging.getLogger(__name__)
@ -304,6 +305,11 @@ def execute_local_scheduled_job(job_json: str) -> None:
"""Worker 执行入口job_json 为 JSON 字符串,包含 target_type 及其参数。
target_type: agent
"""
try:
init_hooks(clear_cache=False)
except Exception as e:
logger.warning(f"初始化钩子系统失败: {e}")
try:
payload = json.loads(job_json)
except Exception as e: