kcm 과제 프로젝트
jungheelee / kcd-proj-jhlee0828 Goto Github PK
View Code? Open in Web Editor NEWkcm 과제 프로젝트
License: MIT License
kcm 과제 프로젝트
License: MIT License
문제
해결방안
/users/getToken
API키 & API secret으로 access_token을 발급받습니다.access_token의 만료기한은 발행 시간 부터 30분입니다. 만료된 토큰으로 API 요청을 하면 401 Unauthorized 응답을 받습니다.
재발행 (만료 후 발급): 새로운 access token을 발급한다. (만료기한: 발행시간 후 30분)
재사용 (만료 전 발급): 기존 access token을 발급한다. (만료기한: 기존과 동일, 단 기존 만료시간 전 1분이내 요청 시 5분 연장 됨)
기존로직
@Transactional
func serviceCode(req Requset){
if validateAndGetPayment.isValid
then executeAndFinalizePayment
}
private fun validateAndGetPayment(transactionKey: String): PaymentEntity {
val payment = paymentRepository.findByTransactionKey(transactionKey)
if (payment.paymentStatus != PaymentStatus.READY) { // here
throw PaymentFailedException("Payment is already processed")
}
}
private fun executeAndFinalizePayment(): {
savePaymentStatusWithHistory(payment, PaymentStatus.IN_PROGRESS)
savePaymentStatusWithHistory(payment, finalStatus)
}
선택지 | 장점 | 단점 |
---|---|---|
Optimistic Locking | 간단하게 구현 가능, 데드락 위험 낮음 | 충돌 시 재시도 필요, 일부만 성공할 수 있음 |
Pessimistic Locking | 동시성 문제를 명확하게 해결 | 데드락 위험 있음, 자원을 많이 사용 |
Distributed Lock | 분산 환경에서도 잘 작동 | 외부 시스템 필요, 복잡성 증가, ex) Redis Zookeeper |
Eventual Consistency | 확장성 좋음, 복잡한 비즈니스 로직에 적합 | 일관성을 바로 보장하지 않음, 복잡성 증가 |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.