fix: 添加事务注解修复删除操作异常

- 在 cleanupExpiredProcessedTrades 方法上添加 @Transactional 注解
- 修复 TransactionRequiredException 异常
- 删除操作必须在事务中执行
This commit is contained in:
WrBug
2026-01-15 04:19:46 +08:00
parent c53fcde5d7
commit 0c7f34a28a
@@ -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