diff --git a/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionFixedEventHandler.kt b/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionFixedEventHandler.kt index d53257d1..37f2231e 100644 --- a/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionFixedEventHandler.kt +++ b/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionFixedEventHandler.kt @@ -10,6 +10,8 @@ import com.depromeet.whatnow.events.domainEvent.InteractionFixedEvent import mu.KLogger import mu.KotlinLogging import org.springframework.scheduling.annotation.Async +import org.springframework.transaction.annotation.Propagation +import org.springframework.transaction.annotation.Transactional import org.springframework.transaction.event.TransactionPhase import org.springframework.transaction.event.TransactionalEventListener @@ -23,6 +25,7 @@ class InteractionFixedEventHandler( val logger: KLogger = KotlinLogging.logger {} @Async + @Transactional(propagation = Propagation.REQUIRES_NEW) @TransactionalEventListener(classes = [InteractionFixedEvent::class], phase = TransactionPhase.AFTER_COMMIT) fun handleInteractionFixedEvent(event: InteractionFixedEvent) { val promiseId = event.promiseId diff --git a/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionHistoryRegisterHandler.kt b/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionHistoryRegisterHandler.kt index 79f6c01f..9ee65a8c 100644 --- a/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionHistoryRegisterHandler.kt +++ b/Whatnow-Domain/src/main/kotlin/com/depromeet/whatnow/events/handler/InteractionHistoryRegisterHandler.kt @@ -39,21 +39,19 @@ class InteractionHistoryRegisterHandler( } val targetUser = userAdapter.queryUser(event.targetUserId) - if (!targetUser.fcmNotification.appAlarm) { - return - } - val user = userAdapter.queryUser(event.userId) val data: MutableMap = mutableMapOf() data["notificationType"] = NotificationType.INTERACTION.name - fcmService.sendMessageAsync( - targetUser.fcmNotification.fcmToken, - "이모지 투척!", - "from. $user.nickname", - data, - ) + if (targetUser.fcmNotification.appAlarm) { + fcmService.sendMessageAsync( + targetUser.fcmNotification.fcmToken, + "이모지 투척!", + "from. $user.nickname", + data, + ) + } notificationDomainService.saveForInteraction(event.promiseId, user.id!!, event.interactionType, targetUser.id!!) }