Repository navigation
🐛(backend) read waffle flags by their name so the cache is flushed - #3062
sanketpatel32 wants to merge 1 commit into
Conversation
FeatureFlag was a (str, Enum) mixin, so str(member) returned "FeatureFlag.FLAG_X" instead of the flag name. django-waffle keys its Flag rows and its cache entries on str(name), so the reads and the cache flushes happening on flag saves never matched: the first read answer stayed cached forever and flag updates from the admin never took effect. Making FeatureFlag a StrEnum makes str(member) the flag name again, matching every Flag row and cache entry. Refs suitenumerique#2975 Signed-off-by: Sanket Patel <sanpatel323@gmail.com>
|
No actionable comments were generated in the recent review. WalkthroughFeatureFlag now subclasses StrEnum, so its string form uses the flag value. New tests check flag lookup by that value and verify that a saved flag change is visible on a subsequent request after the cache flush. The Unreleased changelog records the fix. Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Suggested reviewers: Merge Risk:
|
Purpose
Fixes #2975.
FeatureFlagwas a(str, Enum)mixin, sostr(member)returned"FeatureFlag.FLAG_X"instead of the flag name. django-waffle keys itsFlagrows and its cache entries onstr(name), so reads and the cache flushes on flag saves never matched: the first read answer stayed cached forever and flag updates from the admin never took effect.Proposal
FeatureFlagaStrEnumsostr(member)is the flag name.External contributions
General requirements
CI requirements
git commit --signoff(DCO compliance)git commit -S) — no signing key is available in this environment; let me know if it is required and I will arrange it<gitmoji>(type) title description## [Unreleased]section (if noticeable change)AI requirements