This commit is contained in:
2025-11-10 11:01:45 +03:30
parent 66f8818679
commit be29ab8cfa
2 changed files with 4 additions and 3 deletions

View File

@@ -43,16 +43,16 @@ class QuotaDistributionService:
}
@transaction.atomic
def consume(self, weight): # noqa
def consume(self, amount): # noqa
"""
Consume 'amount' of weight across all distributions in order.
Automatically splits usage if needed.
"""
if weight > self.remaining_weight:
if amount > self.remaining_weight:
raise APIException('Not enough weight to consume')
remaining_to_consume = weight
remaining_to_consume = amount
for dist in self.distribution.select_for_update():
if remaining_to_consume <= 0: