From 71bd20cf734a7171f12a75b269550b8f684e6de4 Mon Sep 17 00:00:00 2001 From: Yansong Zhang <916125788@qq.com> Date: Thu, 8 Jan 2026 11:08:34 +0800 Subject: [PATCH] add rowcount check --- api/services/credit_pool_service.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/api/services/credit_pool_service.py b/api/services/credit_pool_service.py index 6214900c61..2a4b087007 100644 --- a/api/services/credit_pool_service.py +++ b/api/services/credit_pool_service.py @@ -61,12 +61,8 @@ class CreditPoolService: TenantCreditPool.quota_used + credits_required <= TenantCreditPool.quota_limit, ] stmt = update(TenantCreditPool).where(*where_conditions).values(**update_values) - result: CursorResult = session.execute(stmt) + session.execute(stmt) session.commit() - if result.rowcount == 0: - raise QuotaExceededError( - f"Insufficient credits. Required: {credits_required}, Available: {pool.remaining_credits}" - ) except Exception: logger.exception("Failed to deduct credits for tenant %s", tenant_id) raise QuotaExceededError("Failed to deduct credits")