diff --git a/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationListener.kt b/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationListener.kt index ff0d6a34..5ca84424 100644 --- a/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationListener.kt +++ b/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationListener.kt @@ -72,6 +72,8 @@ class PushNotificationListener( pushNotificationService.saveAll(pushNotifications) } + @Async + @Transactional(propagation = Propagation.REQUIRES_NEW) @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) fun deleteNotifications(event: DeleteTaskNotificationEvent) { logger.info("DeleteTaskAlarmEvent: $event") @@ -100,6 +102,8 @@ class PushNotificationListener( pushNotificationService.save(pushNotification) } + @Async + @Transactional(propagation = Propagation.REQUIRES_NEW) @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) fun saveSupportNotifications(event: SupportNotificationSaveEvent) { logger.info("SupportNotificationSaveEvent: $event") diff --git a/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationService.kt b/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationService.kt index 3fb105b5..55815ffb 100644 --- a/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationService.kt +++ b/src/main/kotlin/com/ssak3/timeattack/notifications/service/PushNotificationService.kt @@ -26,6 +26,7 @@ class PushNotificationService( ).map(PushNotification::fromEntity) } + @Transactional fun delete(task: Task) { val now = LocalDateTime.now() val entities = pushNotificationRepository.findAllByTaskAndScheduledAtIsAfter(task.toEntity(), now)