-
Notifications
You must be signed in to change notification settings - Fork 1
[#23] 장애여부, 수수료 기준으로 pg 라우팅 #25
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
base: main
Are you sure you want to change the base?
Conversation
SinJeongEun
commented
Nov 17, 2025
- zset pg:route:CARD:SHIN_HAN
- 서버장애pg 캐싱 ttl 30분
1. zset pg:route:CARD:SHIN_HAN 2. 서버장애pg 캐싱 ttl 30분
|
|
||
| public abstract PgProvider getPgProvider(); | ||
|
|
||
| } |
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.
@f-lab-lyan 멘토님
각pg 는 PgStrategy 를 구현하고
요청에 따라 해당pg의 Card | Easy | Phone]PayService 를 실행하도록 구현해보려고 합니다.
class TossPgStrategy extends PgStrategy {
private final TossCardSevice cardService;
private final TossEasyPaySevice easyPayService;
protected String process(String request) {
return switch (request) {
case CARD -> cardService.approveCard(command);
case EASY_PAY -> easyPayService.approveEasyPay(command);
}
}
}| .filter(pg -> pg.name().equalsIgnoreCase(pgName)) | ||
| .findFirst() | ||
| .orElseThrow(() -> new IllegalArgumentException("미지원 PG사")); | ||
| } |
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.
@f-lab-lyan 멘토님
결제방식 -> 카드/통신사 기준으로 유효한 pg사 추출하기 위해
이렇게 관리하도록 했습니다
| private String buildRouteKey(PayMethod payMethod, PayProvider payProvider) { | ||
| return ROUTE_KEY_PREFIX + payMethod.name() + ":" + payProvider.name(); | ||
| } | ||
| } |
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.
@f-lab-lyan 멘토님
- 결제방식+카드사 별 수수료 랭킹 관리 는 zset
pg:route:CARD:SHIN_HAN으로 관리되도록 했습니다 - 서버 장에는 string
pg:health:PG사이름에 값이 존재하면 장애로 관리되도록 했습니다
| feeInfo.getFeeRate().doubleValue()); | ||
| }); | ||
| } | ||
|
|
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.
@f-lab-lyan 멘토님
-
initPgCache()
해당 기능이 처음 개발되었고,
여러명이 동시에 요청이 온 경우 cache miss 로 db조회 하고 캐싱하는 작업을 하게될 거 같아
초기화를 추가해봤습니다. -
추가적으로 일부 수수료가 변경된 경우 어떻게 처리하는지 궁금합니다.
(해당 키를 직접 삭제하는지 / 관리자측에서 수수료 변경되면 refresh() 호출하도록 설계하는지)