Skip to content

Commit

Permalink
Also use saturating_add in should_defer_due_to_object_congestion
Browse files Browse the repository at this point in the history
  • Loading branch information
aschran authored and ebmifa committed Nov 21, 2024
1 parent 9fd6e1e commit 837bf41
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ impl SharedObjectCongestionTracker {
let start_cost = self.compute_tx_start_at_cost(&shared_input_objects);

// Allow tx if it's within budget.
if start_cost + tx_cost <= self.max_accumulated_txn_cost_per_object_in_commit {
if start_cost.saturating_add(tx_cost) <= self.max_accumulated_txn_cost_per_object_in_commit
{
return None;
}

// Allow over-budget tx if it's not above the overage limit.
if start_cost <= self.max_accumulated_txn_cost_per_object_in_commit
&& start_cost + tx_cost
&& start_cost.saturating_add(tx_cost)
<= self
.max_accumulated_txn_cost_per_object_in_commit
.saturating_add(self.max_txn_cost_overage_per_object_in_commit)
Expand Down

0 comments on commit 837bf41

Please sign in to comment.