Skip to content

Commit

Permalink
code (#6088)
Browse files Browse the repository at this point in the history
Co-authored-by: Rachel Chen <[email protected]>
  • Loading branch information
xurui-c and Rachel Chen committed Jul 3, 2024
1 parent 1efe9ae commit 2cd5cc1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions snuba/web/db_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,18 +869,19 @@ def _apply_allocation_policies_quota(
allowance = allocation_policy.get_quota_allowance(
attribution_info.tenant_ids, query_id
)
num_threads = min(num_threads, allowance.max_threads)
can_run &= allowance.can_run
quota_allowances[allocation_policy.config_key()] = allowance
span.set_data(
"quota_allowance",
quota_allowances[allocation_policy.config_key()],
)
if allowance.is_throttled:
throttle_quota_and_policy = _QuotaAndPolicy(
quota_allowance=allowance,
policy_name=allocation_policy.config_key(),
)
if allowance.max_threads < num_threads:
throttle_quota_and_policy = _QuotaAndPolicy(
quota_allowance=allowance,
policy_name=allocation_policy.config_key(),
)
num_threads = min(num_threads, allowance.max_threads)
if not can_run:
rejection_quota_and_policy = _QuotaAndPolicy(
quota_allowance=allowance,
Expand Down

0 comments on commit 2cd5cc1

Please sign in to comment.