Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ private void validateForNewSignUp(UserJpaEntity user) {

userRepository.findByPhoneNumber(user.getOriginPhoneNumber())
.ifPresent(existingUser -> {
if (existingUser.isPendingUser()) {
switch (existingUser.getProvider()) {
case MOSU:
throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS);
case KAKAO:
throw new CustomRuntimeException(ErrorCode.KAKAO_DUPLICATED);
}
if (existingUser.isKakaoUser()) {
throw new CustomRuntimeException(ErrorCode.KAKAO_DUPLICATED);
} else if (existingUser.isPendingUser() && existingUser.isMosuUser()) {
throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS);
}
Comment on lines +33 to 37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

현재 로직에서 !existingUser.isKakaoUser()existingUser.isMosuUser()와 동일한 의미를 가집니다. (AuthProviderKAKAOMOSU 두 가지만 있기 때문입니다.) 따라서 else if 문에서 isMosuUser() 확인은 중복되므로 제거하여 코드를 더 간결하게 만들 수 있습니다.

Suggested change
if (existingUser.isKakaoUser()) {
throw new CustomRuntimeException(ErrorCode.KAKAO_DUPLICATED);
} else if (existingUser.isPendingUser() && existingUser.isMosuUser()) {
throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS);
}
if (existingUser.isKakaoUser()) {
throw new CustomRuntimeException(ErrorCode.KAKAO_DUPLICATED);
} else if (existingUser.isPendingUser()) {
throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS);
}

});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public void updateUserInfo(
public boolean isMosuUser() {
return this.provider.equals(AuthProvider.MOSU);
}

public boolean isKakaoUser() {
return this.provider.equals(AuthProvider.KAKAO);
}

public boolean isPendingUser() {
return this.userRole.equals(UserRole.ROLE_PENDING);
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ server:
include-stacktrace: never

spring:
threads:
virtual:
enabled: true
Comment on lines +13 to +15

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

가상 쓰레드를 활성화하면 Spring Boot는 웹 요청을 처리하기 위해 가상 쓰레드를 사용하게 됩니다. 이는 좋은 변화입니다.

하지만, 프로젝트 내에 ThreadPoolConfig가 별도로 설정되어 있어 @Async 어노테이션을 사용하는 비동기 작업들은 계속해서 기존의 플랫폼 쓰레드 풀을 사용하게 됩니다. 만약 비동기 작업에도 가상 쓰레드를 적용하고자 하신다면 ThreadPoolConfig 설정을 제거하거나 가상 쓰레드를 사용하도록 수정하는 것을 고려해 보시는 것이 좋습니다.

Spring Boot 3.2 이상에서는 spring.threads.virtual.enabled=true 설정 시, 별도의 TaskExecutor 빈이 없으면 @Async 작업에 자동으로 가상 쓰레드를 사용합니다. 현재 구성은 이 기본 동작을 재정의하고 있습니다. 의도된 동작이 아니라면 수정이 필요해 보입니다.


config:
import:
- optional:file:.env[.properties]
Expand Down