test
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user