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);