From 982b637d47517038806e323fb9799e1efcbd5704 Mon Sep 17 00:00:00 2001 From: Jan Date: Fri, 7 Nov 2025 18:39:19 +0100 Subject: [PATCH] Refined `BulkOperationRepository` timeout handling logic: renamed `timeout` to `cleanupTimeouts` and expanded state conditions to include `SCHEDULED`. --- .../lcc/repositories/bulk/BulkOperationRepository.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/avatic/lcc/repositories/bulk/BulkOperationRepository.java b/src/main/java/de/avatic/lcc/repositories/bulk/BulkOperationRepository.java index 36273a0..8d8b868 100644 --- a/src/main/java/de/avatic/lcc/repositories/bulk/BulkOperationRepository.java +++ b/src/main/java/de/avatic/lcc/repositories/bulk/BulkOperationRepository.java @@ -119,7 +119,7 @@ public class BulkOperationRepository { @Transactional public List listByUserId(Integer userId) { - timeout(userId); + cleanupTimeouts(userId); String sql = """ SELECT id, user_id, bulk_file_type, bulk_processing_type, state, created_at, validity_period_id @@ -132,10 +132,10 @@ public class BulkOperationRepository { return jdbcTemplate.query(sql, new BulkOperationRowMapper(true), userId); } - private void timeout(Integer userId) { + private void cleanupTimeouts(Integer userId) { String sql = """ - UPDATE bulk_operation SET state = 'EXCEPTION' WHERE user_id = ? AND state = 'PROCESSING' AND created_at < NOW() - INTERVAL 30 MINUTE + UPDATE bulk_operation SET state = 'EXCEPTION' WHERE user_id = ? AND (state = 'PROCESSING' OR state = 'SCHEDULED') AND created_at < NOW() - INTERVAL 30 MINUTE """; jdbcTemplate.update(sql, userId);