Skip to content

Commit

Permalink
fix: 투표 끝낸 후 결과 알림만 새로운 트랜잭션에서 생성한다
Browse files Browse the repository at this point in the history
  • Loading branch information
melonturtle committed Mar 14, 2024
1 parent a3f573e commit ce5e3c0
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ private void addAuthorsNotificationIfAuthorListeningVoteResult(Topic topic, List
}
}

/**
* Notification 생성 트랜잭션 분리하기 위해 새로운 트랜잭션에서 실행됨
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Transactional
public void notifyLikeInComment(LikedComment likedComment) {
if (shouldNotifyLikeInComment(likedComment)) {
LikeInCommentNotification notification = new LikeInCommentNotification(likedComment.getComment());
Expand All @@ -105,10 +102,7 @@ private boolean shouldNotifyLikeInComment(LikedComment likedComment) {
return !likerIsWriter && writerListenLikeInComment;
}

/**
* Notification 생성 트랜잭션 분리하기 위해 새로운 트랜잭션에서 실행됨
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Transactional
public void notifyCommentOnTopic(Comment comment) {
if (shouldNotifyCommentOnTopic(comment)) {
CommentOnTopicNotification notification = new CommentOnTopicNotification(comment);
Expand All @@ -128,10 +122,7 @@ private boolean shouldNotifyCommentOnTopic(Comment comment) {
return commenterIsNotAuthor && authorListenCommentOnTopic;
}

/**
* Notification 생성 트랜잭션 분리하기 위해 새로운 트랜잭션에서 실행됨
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Transactional
public void notifyVoteCountOnTopic(Topic topic) {
if (shouldNotifyVoteCountForTopic(topic)) {
VoteCountOnTopicNotification notification = new VoteCountOnTopicNotification(topic);
Expand Down

0 comments on commit ce5e3c0

Please sign in to comment.