fix(billing): improve quota handling and error reporting for pre-consume operations

This commit is contained in:
CaIon
2026-07-11 13:14:22 +08:00
parent 621927f710
commit d9595831bf
12 changed files with 246 additions and 61 deletions
+3 -5
View File
@@ -13,9 +13,7 @@ func QuotaRound(f float64) int {
return common.QuotaRound(f)
}
// QuotaRoundChecked is QuotaRound but also reports whether the result had to
// be saturated. Pre-consume callers use this to reject an unrepresentable
// estimate before any quota is deducted.
func QuotaRoundChecked(f float64) (int, *common.QuotaClamp) {
return common.QuotaRoundChecked(f)
// QuotaRoundStrict rejects an unrepresentable pre-consume estimate.
func QuotaRoundStrict(f float64) (int, error) {
return common.QuotaRoundStrict(f)
}