Skip to content

fix: make sure quota limiting fields are set #30911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2025

Conversation

zlwaterfield
Copy link
Contributor

@zlwaterfield zlwaterfield commented Apr 8, 2025

Changes

We are not explicitly setting the quota limiting fields on the organization usage, and it looks like there is an error from that.

This adds quote a few db calls so we may want to improve the efficiency here somehow.

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

It doesn't have an impact.

How did you test this code?

Will add tests

@zlwaterfield zlwaterfield self-assigned this Apr 8, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR refactors how the quota limiting fields are updated in an organization's usage summary by batching updates, reducing redundant database calls, and ensuring consistency.

  • Refactored quota limiting updates in ee/billing/quota_limiting.py to use a batched call via update_organization_usage_fields.
  • Updated helper to delete keys when values are None, aligning with expected behavior.
  • Improved consistency in updating both quota_limited_until and quota_limiting_suspended_until fields.
  • Maintained existing quota limiting logic while optimizing database interactions.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks legit

@zlwaterfield zlwaterfield merged commit 7565edd into master Apr 8, 2025
94 checks passed
@zlwaterfield zlwaterfield deleted the zach/quota-limiting-fix-1 branch April 8, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants