fix(quota): 캐릭터 톡 채팅 쿼터 조회

- applyRefillOnEnterAndGetStatus를 적용하여 채팅 쿼터 조회 시 Lazy Refill 적용
This commit is contained in:
Klaus 2025-08-26 17:32:00 +09:00
parent 84ebc1762b
commit 15d0952de8
1 changed files with 2 additions and 8 deletions

View File

@ -61,15 +61,9 @@ class ChatQuotaService(
} }
} }
@Transactional(readOnly = true) @Transactional
fun getStatus(memberId: Long): QuotaStatus { fun getStatus(memberId: Long): QuotaStatus {
val q = repo.findByMemberId(memberId) ?: return QuotaStatus( return applyRefillOnEnterAndGetStatus(memberId)
totalRemaining = FREE_BUCKET,
nextRechargeAtEpochMillis = null
)
val total = q.remainingFree + q.remainingPaid
val epoch = q.nextRechargeAt?.atZone(ZoneId.systemDefault())?.toInstant()?.toEpochMilli()
return QuotaStatus(totalRemaining = total, nextRechargeAtEpochMillis = epoch)
} }
@Transactional @Transactional