-
Notifications
You must be signed in to change notification settings - Fork 0
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
[fix] #198 - isBooking update 안되는 이슈 해결 #199
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
afed125
[#198] fix(Schedule): updateIsBooking 로직 추가
hyerinhwang-sailin 29fb7a9
[#198] fix(ScheduleService): IsBooking update 로직 변경 및 불필요한 주석 제거
hyerinhwang-sailin 3021685
[#198] fix(PerformanceService): getPerformanceDetail readOnly 설정 변경 및…
hyerinhwang-sailin bffb8c9
[#198] feat(BeatApplication): EnableAsync 어노테이션 추가
hyerinhwang-sailin a20f239
[#198] feat(SchedulerConfig): TaskScheduler 스레드 풀 크기 설정
hyerinhwang-sailin 9ecc7d7
[#198] feat(JobSchedulerService): TaskScheduler 서비스 구현
hyerinhwang-sailin 40a083b
[#198] feat(PerformanceManagementService): 공연 생성, 삭제에 따른 스케쥴링 리스트 변화 구현
hyerinhwang-sailin 9fff946
[#198] feat(PerformanceModifyService): 공연 수정에 따른 스케쥴링 리스트 변화 구현
hyerinhwang-sailin 9c18adf
[#198] feat(ScheduleRepository): isBooking true인 공연 조회 로직 추가
hyerinhwang-sailin 9504e15
[#198] fix(ScheduleService): isBooking 관련 불필요한 로직 삭제
hyerinhwang-sailin 07ab48c
[#198] fix(PerformanceService): 조회 메소드 annotation @Transactional(read…
hyerinhwang-sailin 50a0abe
[#198] refactor(GuestBookingService): 매진 여부 확인 메소드 분리 및 log 수정
hyerinhwang-sailin 451930a
[#198] refactor(MemberBookingService): 매진 여부 확인 메소드 분리 및 log 수정
hyerinhwang-sailin 96af323
[#198] feat(TicketService): 예매취소 시 isBooking update 구현
hyerinhwang-sailin bb9de14
[#198] chore(PerformanceService): 코드 포맷터 적용
hyerinhwang-sailin e05b587
Merge branch 'develop' into fix/#198
hyerinhwang-sailin e38d731
[#198] remove(SchedulerConfig): SchedulerConfig 삭제
hyerinhwang-sailin 9fc6fb9
[#198] refactor(TicketService): isBooking update 검증 추가 및 코드 포맷팅 적용
hyerinhwang-sailin 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 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 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 |
---|---|---|
|
@@ -12,17 +12,15 @@ | |
import com.beat.global.common.exception.BadRequestException; | ||
import com.beat.global.common.exception.NotFoundException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class GuestBookingService { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(GuestBookingService.class); | ||
|
||
private final ScheduleRepository scheduleRepository; | ||
private final BookingRepository bookingRepository; | ||
private final UserRepository userRepository; | ||
|
@@ -37,7 +35,7 @@ public GuestBookingResponse createGuestBooking(GuestBookingRequest guestBookingR | |
throw new BadRequestException(ScheduleErrorCode.INSUFFICIENT_TICKETS); | ||
} | ||
|
||
schedule.setSoldTicketCount(schedule.getSoldTicketCount() + guestBookingRequest.purchaseTicketCount()); | ||
updateSoldTicketCountAndIsBooking(schedule, guestBookingRequest.purchaseTicketCount()); | ||
|
||
Users users = bookingRepository.findFirstByBookerNameAndBookerPhoneNumberAndBirthDateAndPassword( | ||
guestBookingRequest.bookerName(), | ||
|
@@ -66,7 +64,7 @@ public GuestBookingResponse createGuestBooking(GuestBookingRequest guestBookingR | |
); | ||
bookingRepository.save(booking); | ||
|
||
logger.info("Booking created: {}", booking); | ||
log.info("Guest Booking created: {}", booking); | ||
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. 디테일 감사합니다! |
||
|
||
return GuestBookingResponse.of( | ||
booking.getId(), | ||
|
@@ -79,8 +77,16 @@ public GuestBookingResponse createGuestBooking(GuestBookingRequest guestBookingR | |
booking.getBookingStatus(), | ||
schedule.getPerformance().getBankName(), | ||
schedule.getPerformance().getAccountNumber(), | ||
totalPaymentAmount, // 회원 예매랑 다른 부분 확인하기 | ||
totalPaymentAmount, | ||
booking.getCreatedAt() | ||
); | ||
} | ||
|
||
private void updateSoldTicketCountAndIsBooking(Schedule schedule, int purchaseTicketCount) { | ||
schedule.setSoldTicketCount(schedule.getSoldTicketCount() + purchaseTicketCount); | ||
|
||
if (schedule.getTotalTicketCount() == schedule.getSoldTicketCount()) { | ||
schedule.updateIsBooking(false); | ||
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. 도메인 메서드 사용 좋습니다! |
||
} | ||
} | ||
} |
This file contains 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.
이 부분에 대해서 저도 공부를 해보았습니다!
이렇게 어플리케이션 클래스 위에 EnableAsync 어노테이션을 사용하면, 기본적으로 SimpleAsyncTaskExecutor가 사용된다고 합니다.
이는 비동기 작업마다 새로운 스레드를 생성하는 스레드풀이라서 리소스 낭비, 성능 저하, 스케일링 문제 등이 발생할 수 있다고 합니다!
그래서 SimpleAsyncTaskExecutor 보다는 ThreadPoolTaskExecutor 같은 제한된 리소스를 사용하는 스레드풀을 사용하는것을 권장한다고 하네요
일단 해당 부분에 대한 고도화는 prod 서버에 공연이 없기도 할 뿐더러, QA시 dev에 예매중인 공연을 대상으로 했을 때, 성능 저하가 크게 없다면 지금 당장 개선해야 될 문제는 아니라고 생각이 듭니다!! (추후 개선하면 좋을 것 같음)
참고 블로그!
https://skydevilk.tistory.com/121
https://dkswnkk.tistory.com/706
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.
공유 감사합니다! 다음 스프린트에서 개선해보겠습니다 :)