Skip to content

Conversation

@SinJeongEun
Copy link
Collaborator

  1. zset pg:route:CARD:SHIN_HAN
  2. 서버장애pg 캐싱 ttl 30분

@SinJeongEun SinJeongEun self-assigned this Nov 17, 2025
@SinJeongEun SinJeongEun added the enhancement New feature or request label Nov 17, 2025
@SinJeongEun SinJeongEun linked an issue Nov 17, 2025 that may be closed by this pull request

public abstract PgProvider getPgProvider();

}
Copy link
Collaborator Author

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사"));
}
Copy link
Collaborator Author

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();
}
}
Copy link
Collaborator Author

@SinJeongEun SinJeongEun Nov 17, 2025

Choose a reason for hiding this comment

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

@f-lab-lyan 멘토님

  1. 결제방식+카드사 별 수수료 랭킹 관리 는 zset pg:route:CARD:SHIN_HAN 으로 관리되도록 했습니다
  2. 서버 장에는 string pg:health:PG사이름 에 값이 존재하면 장애로 관리되도록 했습니다

feeInfo.getFeeRate().doubleValue());
});
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@f-lab-lyan 멘토님

  1. initPgCache()
    해당 기능이 처음 개발되었고,
    여러명이 동시에 요청이 온 경우 cache miss 로 db조회 하고 캐싱하는 작업을 하게될 거 같아
    초기화를 추가해봤습니다.

  2. 추가적으로 일부 수수료가 변경된 경우 어떻게 처리하는지 궁금합니다.
    (해당 키를 직접 삭제하는지 / 관리자측에서 수수료 변경되면 refresh() 호출하도록 설계하는지)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pg 라우팅 및 서버상태 캐싱

2 participants