Repository navigation
refactor: 디스코드 알림을 커밋 이후 비동기로 전송하도록 #852
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
whqtker
merged 13 commits into
develop
from
whqtker/investigate-discord-transactional-outbox
Oct 25, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
0ed0c7a
feat: 디스코드 알림 이벤트 추가
whqtker aa95b97
feat: 커밋 이후 디스코드 알림을 전송하는 리스너 추가
whqtker 2d3d19a
refactor: 성적 제출 알림을 이벤트로 발행
whqtker 5f493b5
refactor: 멘토 신청 알림을 이벤트로 발행
whqtker 1c56bc1
refactor: 학점 검수 결과 표시를 이벤트로 발행
whqtker 5b6bcb6
refactor: 어학 검수 결과 표시를 이벤트로 발행
whqtker b604f51
refactor: 멘토 신청 검수 결과 표시를 이벤트로 발행
whqtker fcfca32
refactor: 신고 알림을 이벤트로 발행
whqtker f0f82a5
refactor: DiscordNotifier 의 비동기 설정 제거
whqtker e3deae6
test: 디스코드 알림 이벤트 리스너 테스트 추가
whqtker 90446c3
test: 디스코드 알림 실패 시 성적 등록 테스트 추가
whqtker 1f28599
test: 디스코드 검수 결과 표시 실패 시 검증상태 수정 테스트 추가
whqtker 4437d42
refactor: 디스코드 알림 리스너 주석 제거
whqtker 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
48 changes: 48 additions & 0 deletions
48
...ain/java/com/example/solidconnection/common/discord/DiscordNotificationEventListener.java
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 |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| package com.example.solidconnection.common.discord; | ||
|
|
||
| import com.example.solidconnection.common.discord.event.DiscordReportCreatedEvent; | ||
| import com.example.solidconnection.common.discord.event.DiscordReviewCompletedEvent; | ||
| import com.example.solidconnection.common.discord.event.DiscordReviewRequestedEvent; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.scheduling.annotation.Async; | ||
| import org.springframework.scheduling.annotation.EnableAsync; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.transaction.event.TransactionalEventListener; | ||
|
|
||
| @Component | ||
| @EnableAsync | ||
| @RequiredArgsConstructor | ||
| @Slf4j | ||
| public class DiscordNotificationEventListener { | ||
|
|
||
| private final DiscordNotifier discordNotifier; | ||
|
|
||
| @Async("asyncExecutor") | ||
| @TransactionalEventListener | ||
| public void handleReviewRequested(DiscordReviewRequestedEvent event) { | ||
| try { | ||
| discordNotifier.notify(event.type(), event.reviewId(), event.applicantInfo()); | ||
| } catch (Exception e) { | ||
| log.error("검수 요청 알림을 전송하지 못했습니다. reviewType={}, reviewId={}, exception={}", | ||
| event.type(), event.reviewId(), e.getClass().getSimpleName()); | ||
| } | ||
| } | ||
|
|
||
| @Async("asyncExecutor") | ||
| @TransactionalEventListener | ||
| public void handleReviewCompleted(DiscordReviewCompletedEvent event) { | ||
| try { | ||
| discordNotifier.markReviewResult(event.type(), event.reviewId(), event.applicantInfo(), event.marker()); | ||
| } catch (Exception e) { | ||
| log.error("검수 결과를 표시하지 못했습니다. reviewType={}, reviewId={}, exception={}", | ||
| event.type(), event.reviewId(), e.getClass().getSimpleName()); | ||
| } | ||
| } | ||
|
|
||
| @Async("asyncExecutor") | ||
| @TransactionalEventListener | ||
| public void handleReportCreated(DiscordReportCreatedEvent event) { | ||
| discordNotifier.notify(DiscordNotificationType.REPORT, "신고자 ID: " + event.reporterId()); | ||
| } | ||
| } | ||
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
7 changes: 7 additions & 0 deletions
7
...main/java/com/example/solidconnection/common/discord/event/DiscordReportCreatedEvent.java
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.example.solidconnection.common.discord.event; | ||
|
|
||
| public record DiscordReportCreatedEvent( | ||
| long reporterId | ||
| ) { | ||
|
|
||
| } |
12 changes: 12 additions & 0 deletions
12
...in/java/com/example/solidconnection/common/discord/event/DiscordReviewCompletedEvent.java
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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.example.solidconnection.common.discord.event; | ||
|
|
||
| import com.example.solidconnection.common.discord.DiscordNotificationType; | ||
|
|
||
| public record DiscordReviewCompletedEvent( | ||
| DiscordNotificationType type, | ||
| long reviewId, | ||
| String applicantInfo, | ||
| String marker | ||
| ) { | ||
|
|
||
| } |
11 changes: 11 additions & 0 deletions
11
...in/java/com/example/solidconnection/common/discord/event/DiscordReviewRequestedEvent.java
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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.example.solidconnection.common.discord.event; | ||
|
|
||
| import com.example.solidconnection.common.discord.DiscordNotificationType; | ||
|
|
||
| public record DiscordReviewRequestedEvent( | ||
| DiscordNotificationType type, | ||
| long reviewId, | ||
| String applicantInfo | ||
| ) { | ||
|
|
||
| } |
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
Oops, something went wrong.
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.
When an administrator updates the same score twice, for example approving it and then correcting it to rejected, both committed events can execute concurrently because
asyncExecutorhas five core threads. If the earlier event's Discord PATCH finishes last, it overwrites the newer result with an approved marker even though the database contains REJECTED. This can now happen even for sequential HTTP requests; previously each request completed its Discord edit before returning. Serialize result updates per review, or otherwise prevent older events from overwriting newer results.Useful? React with 👍 / 👎.