From f23895985690dc341b4e69d4b29a44be989c23df Mon Sep 17 00:00:00 2001 From: matevip Date: Sun, 7 Jun 2026 19:53:12 +0800 Subject: [PATCH] refactor(wiki): drop ineffective @Transactional on self-invoked scan-update methods updateTextContentFromScan / updateBinaryFileFromScan are only reached via self-invocation from the ingest* methods, so the proxy-based @Transactional never applied. Each runs a single atomic updateById; remove the misleading annotation and document why. --- .../vip/mate/wiki/service/WikiRawMaterialService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiRawMaterialService.java b/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiRawMaterialService.java index d3b9dc4c..e1792b3c 100644 --- a/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiRawMaterialService.java +++ b/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiRawMaterialService.java @@ -136,8 +136,12 @@ public class WikiRawMaterialService { * Update an existing text raw in-place when a directory-scanned file has changed content. * Resets processing state and triggers re-processing so new pages are generated from the * updated content without leaving a stale duplicate row alongside the new one. + * + *

No {@code @Transactional}: this runs a single atomic {@code updateById} and is only + * reached via self-invocation from {@code ingestTextFileFromScan}, where the annotation + * would be bypassed by the proxy anyway. The re-processing event is published after the + * row is persisted so the async listener reads committed state. */ - @Transactional public void updateTextContentFromScan(Long rawId, String title, String content, String sourcePath) { WikiRawMaterialEntity entity = rawMapper.selectById(rawId); if (entity == null) return; @@ -211,8 +215,11 @@ public class WikiRawMaterialService { /** * Update an existing binary raw in-place when a directory-scanned file has changed content. + * + *

No {@code @Transactional}: single atomic {@code updateById} reached only via + * self-invocation from {@code ingestBinaryFileFromScan} (proxy bypassed); the re-processing + * event is published after the row is persisted. */ - @Transactional public void updateBinaryFileFromScan(Long rawId, String sourcePath, long fileSize, String hash) { WikiRawMaterialEntity entity = rawMapper.selectById(rawId); if (entity == null) return;