refactor: deprecate int32 (#7025)

* refactor: deprecate int32

* fix(db): reject legacy user quota schemas at startup

* fix(quota): enforce wallet bounds and saturating billing conversions

* fix(rate-limit): keep count*duration from wrapping int64

* fix: error message
This commit is contained in:
Seefs
2026-08-26 20:57:54 +08:00
committed by GitHub
parent 2d8e50bf36
commit a073f74b38
35 changed files with 445 additions and 116 deletions
+3 -4
View File
@@ -88,15 +88,14 @@ func calcViolationFeeQuota(amount, groupRatio float64) int {
if groupRatio <= 0 {
return 0
}
quota := decimal.NewFromFloat(amount).
quota := common.QuotaFromDecimal(decimal.NewFromFloat(amount).
Mul(decimal.NewFromFloat(common.QuotaPerUnit)).
Mul(decimal.NewFromFloat(groupRatio)).
Round(0).
IntPart()
Round(0))
if quota <= 0 {
return 0
}
return int(quota)
return quota
}
// ChargeViolationFeeIfNeeded charges an additional fee after the normal flow finishes (including refund).