Subtract FREE_TIER_MONTHLY_SPENDING_LIMIT from reported monthly spend (#19358)

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2024-10-17 13:09:50 +02:00 committed by GitHub
parent 455f241c6a
commit 8c910540ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 52 deletions

View file

@ -469,7 +469,9 @@ async fn check_usage_limit(
));
}
if usage.spending_this_month >= Cents(claims.max_monthly_spend_in_cents) {
if (usage.spending_this_month - FREE_TIER_MONTHLY_SPENDING_LIMIT)
>= Cents(claims.max_monthly_spend_in_cents)
{
return Err(Error::Http(
StatusCode::FORBIDDEN,
"Maximum spending limit reached for this month.".to_string(),