Skip to content
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

Improve premium feature guards #5890

Merged
merged 3 commits into from
Sep 10, 2021
Merged

Conversation

Twixes
Copy link
Collaborator

@Twixes Twixes commented Sep 10, 2021

Changes

A refactor of a few places that handle premium features being available or not (see commits + descriptions) spun out from #4263 PR.

Fetching all fields is especially painful when there's a field-adding migration that hasn't ran yet, as Django selects fields explicitly, and when it does that with a field it knows about but the DB doesn't yet, the whole query fails. And because `sync_all_organization_available_features` is ran on Django server start, the server fails to start, refusing to hot reload again until a full server restart.
@timgl timgl temporarily deployed to posthog-pr-5890 September 10, 2021 08:18 Inactive
Copy link
Contributor

@rcmarron rcmarron left a comment

Choose a reason for hiding this comment

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

lgtm!

Semi-related question: is the rule of thumb that we keep all of the 'logic' related to a component in kea and out of the component itself?

@Twixes
Copy link
Collaborator Author

Twixes commented Sep 10, 2021

Good observation Rick, generally yes. As pretty noticeable in this PR, managing state beyond the strict scope of a single component is hugely nicer with Kea logics, especially since they can be very easily interlinked.

@Twixes Twixes merged commit 1d07c76 into master Sep 10, 2021
@Twixes Twixes deleted the improve-premium-feature-guards branch September 10, 2021 22:28
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.

3 participants