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

feat(flags): Enable caching for resilient responses #13708

Merged
merged 19 commits into from
Jan 18, 2023
Merged

Conversation

neilkakkar
Copy link
Collaborator

@neilkakkar neilkakkar commented Jan 13, 2023

Problem

Part of #13601

In this PR:

Introduce caching of team and feature flags. This allows for zero downtime on decide when postgres goes down.

What's in a follow up:

  1. Cache everything on startup

Changes

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

How did you test this code?

Lots of unit tests.

Also, run locally, check decide, make database go down, see decide still works.

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.

Great shout!

posthog/models/team/team.py Outdated Show resolved Hide resolved
Copy link
Member

@EDsCODE EDsCODE left a comment

Choose a reason for hiding this comment

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

Minor comments

posthog/api/feature_flag.py Show resolved Hide resolved
posthog/models/feature_flag.py Outdated Show resolved Hide resolved
@@ -15,4 +16,5 @@
"Role",
"RoleMembership",
"EnterprisePropertyDefinition",
"FeatureFlagRoleAccess",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@liyiy this is the reason when running tests locally you'd get the ee_ffroleaccess table doesn't exist, even when it existed in the test db. Wasn't registered in django

@neilkakkar
Copy link
Collaborator Author

@EDsCODE lmk if you have any pending comments, will merge this now so I can babysit in Cloud.

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