Skip to content

Commit

Permalink
fix: tolerate missing rows_synced in billing response (#18695)
Browse files Browse the repository at this point in the history
* tolerate missing rows_synced

* more fix
  • Loading branch information
raquelmsmith authored Nov 16, 2023
1 parent a7c51d0 commit db82cff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ee/billing/billing_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def update_org_details(self, organization: Organization, billing_status: Billing
usage_info = OrganizationUsageInfo(
events=usage_summary["events"],
recordings=usage_summary["recordings"],
rows_synced=usage_summary["rows_synced"],
rows_synced=usage_summary.get("rows_synced", None),
period=[
data["billing_period"]["current_period_start"],
data["billing_period"]["current_period_end"],
Expand Down
4 changes: 4 additions & 0 deletions ee/billing/quota_limiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def org_quota_limited_until(organization: Organization, resource: QuotaResource)
return None

summary = organization.usage.get(resource.value, {})
if not summary:
return None
usage = summary.get("usage", 0)
todays_usage = summary.get("todays_usage", 0)
limit = summary.get("limit")
Expand Down Expand Up @@ -146,6 +148,8 @@ def set_org_usage_summary(

for field in ["events", "recordings", "rows_synced"]:
resource_usage = new_usage[field] # type: ignore
if not resource_usage:
continue

if todays_usage:
resource_usage["todays_usage"] = todays_usage[field] # type: ignore
Expand Down

0 comments on commit db82cff

Please sign in to comment.