temp(quota): 기다리면 무료 쿼터 시간
- 테스트를 위해 임시로 1분으로 수정
This commit is contained in:
@@ -12,7 +12,7 @@ class ChatQuotaService(
|
||||
) {
|
||||
companion object {
|
||||
private const val FREE_BUCKET = 10
|
||||
private const val RECHARGE_HOURS = 6L
|
||||
private const val RECHARGE_HOURS = 1L
|
||||
}
|
||||
|
||||
data class QuotaStatus(
|
||||
@@ -41,20 +41,20 @@ class ChatQuotaService(
|
||||
quota.remainingFree > 0 -> {
|
||||
quota.remainingFree -= 1
|
||||
if (quota.remainingFree + quota.remainingPaid == 0 && quota.nextRechargeAt == null) {
|
||||
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
|
||||
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
|
||||
}
|
||||
}
|
||||
|
||||
quota.remainingPaid > 0 -> {
|
||||
quota.remainingPaid -= 1
|
||||
if (quota.remainingFree + quota.remainingPaid == 0 && quota.nextRechargeAt == null) {
|
||||
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
|
||||
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
if (quota.nextRechargeAt == null) {
|
||||
quota.nextRechargeAt = now.plusHours(RECHARGE_HOURS)
|
||||
quota.nextRechargeAt = now.plusMinutes(RECHARGE_HOURS)
|
||||
}
|
||||
throw SodaException("채팅 가능 횟수가 모두 소진되었습니다. 다음 무료 충전 이후 이용해주세요.")
|
||||
}
|
||||
|
Reference in New Issue
Block a user