From 15d0952de86e2ead1c7af1d44b00b7a8f61768a1 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 26 Aug 2025 17:32:00 +0900 Subject: [PATCH] =?UTF-8?q?fix(quota):=20=EC=BA=90=EB=A6=AD=ED=84=B0=20?= =?UTF-8?q?=ED=86=A1=20=EC=B1=84=ED=8C=85=20=EC=BF=BC=ED=84=B0=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20-=20applyRefillOnEnterAndGetStatus=EB=A5=BC=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=ED=95=98=EC=97=AC=20=EC=B1=84=ED=8C=85=20?= =?UTF-8?q?=EC=BF=BC=ED=84=B0=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20Lazy=20Re?= =?UTF-8?q?fill=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vividnext/sodalive/chat/quota/ChatQuotaService.kt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt index 69964fd..80b6ccf 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/chat/quota/ChatQuotaService.kt @@ -61,15 +61,9 @@ class ChatQuotaService( } } - @Transactional(readOnly = true) + @Transactional fun getStatus(memberId: Long): QuotaStatus { - val q = repo.findByMemberId(memberId) ?: return QuotaStatus( - 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) + return applyRefillOnEnterAndGetStatus(memberId) } @Transactional