Skip to content

Commit

Permalink
태그 중복 생성 시 재시도 처리의 위치를 변경 (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
jminkkk authored Jan 3, 2025
1 parent 2d7ea4a commit ffe181b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions backend/src/main/java/codezap/tag/service/TagService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.List;
import java.util.stream.Collectors;

import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand All @@ -25,6 +27,7 @@ public class TagService {
private final TagRepository tagRepository;
private final TemplateTagRepository templateTagRepository;

@Retryable(retryFor = DataIntegrityViolationException.class)
@Transactional
public void createTags(Template template, List<String> tagNames) {
List<Tag> existTags = tagRepository.findAllByNames(tagNames);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

import jakarta.annotation.Nullable;

import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Pageable;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down Expand Up @@ -47,7 +45,6 @@ public class TemplateApplicationService {
private final ThumbnailService thumbnailService;
private final LikesService likesService;

@Retryable(retryFor = DataIntegrityViolationException.class, maxAttempts = 3)
@Transactional
public Long create(Member member, CreateTemplateRequest request) {
Category category = categoryService.fetchById(request.categoryId());
Expand Down

0 comments on commit ffe181b

Please sign in to comment.