fix(publish): call sync_llm_product outside transaction block (stale read before commit)

This commit is contained in:
yumoqing 2026-08-04 13:26:29 +08:00
parent 0c4bc661eb
commit 89e6d7cb25

View File

@ -13,6 +13,7 @@ try:
result['success'] = True result['success'] = True
result['message'] = '上架成功' if action == 'published' else '下架成功' result['message'] = '上架成功' if action == 'published' else '下架成功'
if action == 'published': if action == 'published':
# 同步必须放在事务块外:块内未提交时另一连接读到旧状态
env = request._run_ns env = request._run_ns
sync_fn = getattr(env, 'sync_llm_product', None) sync_fn = getattr(env, 'sync_llm_product', None)
if sync_fn: if sync_fn: