-
Notifications
You must be signed in to change notification settings - Fork 14k
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
fix: delete the correct dashboard cache key #11273
fix: delete the correct dashboard cache key #11273
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple questions
superset/models/dashboard.py
Outdated
@@ -294,7 +293,9 @@ def update_thumbnail(self) -> None: | |||
|
|||
@debounce(0.1) | |||
def clear_cache(self) -> None: | |||
cache.delete_memoized(self.full_data) | |||
# pylint: disable=no-member |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to disable this lint error here?
superset/models/dashboard.py
Outdated
@@ -252,8 +252,7 @@ def data(self) -> Dict[str, Any]: | |||
} | |||
|
|||
@cache.memoize( | |||
# manually maintain cache key version | |||
make_name=lambda fname: f"{fname}-v1", | |||
make_name=lambda fname: f"{fname}-v0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not v2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that works, too. Just thought this feature is still unstable so let's start with something small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough
c8010b9
to
13b9039
Compare
@@ -294,7 +293,7 @@ def update_thumbnail(self) -> None: | |||
|
|||
@debounce(0.1) | |||
def clear_cache(self) -> None: | |||
cache.delete_memoized(self.full_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code only updates the hash version related to the function: https://github.com/sh4nks/flask-caching/blob/v1.9.0/flask_caching/__init__.py#L1051-L1052
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix!
superset/models/dashboard.py
Outdated
@@ -252,8 +252,7 @@ def data(self) -> Dict[str, Any]: | |||
} | |||
|
|||
@cache.memoize( | |||
# manually maintain cache key version | |||
make_name=lambda fname: f"{fname}-v1", | |||
make_name=lambda fname: f"{fname}-v0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough
Updated the cache key nonetheless! |
Codecov Report
@@ Coverage Diff @@
## master #11273 +/- ##
==========================================
- Coverage 65.60% 65.60% -0.01%
==========================================
Files 834 834
Lines 39566 39559 -7
Branches 3615 3610 -5
==========================================
- Hits 25959 25954 -5
+ Misses 13498 13496 -2
Partials 109 109
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* bugfix: delete dashboard cache key correctly * update version number
* bugfix: delete dashboard cache key correctly * update version number
SUMMARY
This PR fixes a bug from #11234 where cache keys for dashboard bootstrap data are incorrectly deleted.
We noticed this when some dashboard failed to update cache when updating charts.
delete_memoized
from Flask caching treats instance method and class method differently:BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
ADDITIONAL INFORMATION