Skip to content

Commit 3e14b03

Browse files
authored
Merge pull request #72 from ChainSafe/fix/billing-topup-api-fix
fix: paginated calls of thousands of charges took to long
2 parents 5d76710 + de235bf commit 3e14b03

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/canton_mcp_server/server.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,18 +1413,17 @@ async def create_billing_credit(request: Request):
14131413
description=description or "Top-up via billing portal",
14141414
)
14151415

1416-
# Get updated balance
1417-
billing = await get_chain_balance(user_party)
1418-
14191416
logger.info(f"💳 CreditReceipt created: {contract_id} for {user_party} - {amount} CC")
14201417

1418+
# Intentionally NOT calling get_chain_balance() here. On a busy provider
1419+
# party (thousands of charges + credits) it adds ~25–30 round-trips of
1420+
# paginated /v2/updates walks (~30s) — long enough to exceed the
1421+
# autobot's 30s fetch timeout. Callers that need the post-credit
1422+
# balance should hit GET /billing/balance/{party_id} explicitly.
14211423
return JSONResponse(content={
14221424
"success": True,
14231425
"contractId": contract_id,
14241426
"amount": amount,
1425-
"balance": billing.balance,
1426-
"totalCredited": billing.total_credited,
1427-
"totalCharged": billing.total_charged,
14281427
})
14291428

14301429
except CantonBillingError as e:

0 commit comments

Comments
 (0)