-
Notifications
You must be signed in to change notification settings - Fork 0
[HSC-424] 로그 feature dispatch 날짜 및 enum 매핑 보완 #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,8 +1,10 @@ | ||||||
| package site.holliverse.customer.application.usecase.log; | ||||||
|
|
||||||
| import lombok.extern.slf4j.Slf4j; | ||||||
| import lombok.RequiredArgsConstructor; | ||||||
| import org.springframework.beans.factory.annotation.Value; | ||||||
| import org.springframework.context.annotation.Profile; | ||||||
| import org.springframework.dao.DataIntegrityViolationException; | ||||||
| import org.springframework.stereotype.Service; | ||||||
| import org.springframework.transaction.annotation.Propagation; | ||||||
| import org.springframework.transaction.annotation.Transactional; | ||||||
|
|
@@ -14,6 +16,7 @@ | |||||
| import java.util.List; | ||||||
| import java.util.Optional; | ||||||
|
|
||||||
| @Slf4j | ||||||
| @Service | ||||||
| @Profile("customer") | ||||||
| @RequiredArgsConstructor | ||||||
|
|
@@ -28,6 +31,28 @@ public class UserLogAdminDispatchOutboxStateService { | |||||
| @Value("${app.userlog.admin-dispatch.max-attempts:5}") | ||||||
| private int maxAttempts; | ||||||
|
|
||||||
| @Transactional(propagation = Propagation.REQUIRES_NEW) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛡️ Code Review Report1. 🔍 요약Outbox 패턴의 트랜잭션 원자성 보장 및 예외 처리 방식에 대한 개선이 필요합니다. 특히 2. 🛑 Blocking Issues (Must Fix)
Suggested change
References
|
||||||
| public void storeBatch(List<UserLogAdminDispatchOutbox> rows) { | ||||||
| repository.saveAllAndFlush(rows); | ||||||
| rows.forEach(ignored -> customerMetrics.recordAdminLogFeatureOutbox("stored")); | ||||||
| } | ||||||
|
|
||||||
| @Transactional(propagation = Propagation.REQUIRES_NEW) | ||||||
| public void store(UserLogAdminDispatchOutbox row) { | ||||||
| try { | ||||||
| repository.saveAndFlush(row); | ||||||
| customerMetrics.recordAdminLogFeatureOutbox("stored"); | ||||||
| } catch (DataIntegrityViolationException e) { | ||||||
| customerMetrics.recordAdminLogFeatureOutbox("duplicate"); | ||||||
| log.debug("[UserLog][Outbox] duplicate event_id={} memberId={} eventName={}", | ||||||
| row.getEventId(), row.getMemberId(), row.getEventName()); | ||||||
| } catch (Exception e) { | ||||||
| customerMetrics.recordAdminLogFeatureOutbox("store_error"); | ||||||
| log.warn("[UserLog][Outbox] store failed event_id={} memberId={} eventName={}", | ||||||
| row.getEventId(), row.getMemberId(), row.getEventName(), e); | ||||||
| } | ||||||
| } | ||||||
|
Comment on lines
+40
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Blocking Issue: 트랜잭션 내 예외 처리 및 UnexpectedRollbackException
@Transactional
public void store(UserLogAdminDispatchOutbox row) {
repository.saveAndFlush(row);
customerMetrics.recordAdminLogFeatureOutbox("stored");
} |
||||||
|
|
||||||
| @Transactional | ||||||
| public List<Long> claimReadyBatch(int batchSize) { | ||||||
| List<Long> ids = repository.findReadyEventIdsForUpdate(batchSize); | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛑 Blocking Issue: Fallback 로직의 예외 전파 차단
stateService.store(row)호출 시 발생하는 예외(특히UnexpectedRollbackException)가forEach루프 내부에서 처리되지 않습니다. 중복 데이터 등으로 인해 한 건이라도 실패하면 전체 루프가 중단되고 나머지 로그들이 저장되지 못합니다.