From 0c7f34a28a6cc7143a20f57d1c3dad70703256db Mon Sep 17 00:00:00 2001 From: WrBug Date: Thu, 15 Jan 2026 04:19:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E4=BA=8B=E5=8A=A1?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 cleanupExpiredProcessedTrades 方法上添加 @Transactional 注解 - 修复 TransactionRequiredException 异常 - 删除操作必须在事务中执行 --- .../service/system/ProcessedTradeCleanupService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/ProcessedTradeCleanupService.kt b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/ProcessedTradeCleanupService.kt index ea52491..a34ffe0 100644 --- a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/ProcessedTradeCleanupService.kt +++ b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/ProcessedTradeCleanupService.kt @@ -4,6 +4,7 @@ import com.wrbug.polymarketbot.repository.ProcessedTradeRepository import org.slf4j.LoggerFactory import org.springframework.scheduling.annotation.Scheduled import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional /** * 已处理交易清理服务 @@ -30,6 +31,7 @@ class ProcessedTradeCleanupService( * 每10分钟执行一次 */ @Scheduled(fixedDelay = CLEANUP_INTERVAL_MS) + @Transactional fun cleanupExpiredProcessedTrades() { try { val expireTime = System.currentTimeMillis() - RETENTION_MS