-
Notifications
You must be signed in to change notification settings - Fork 717
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 500 errors when using django redis cache for response caching #11849
Fix 500 errors when using django redis cache for response caching #11849
Conversation
… Django's expectations of a cache backend.
Build Artifacts
|
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.
Tested in a RPi, it fixed the issue and everything worked perfectly.
Code looks good too.
class RedisCache(BaseRedisCache): | ||
def set(self, *args, **kwargs): | ||
""" | ||
Overwrite the set method to not return a value, in line with the Django cache interface |
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.
Brilliant!
@@ -117,7 +117,7 @@ def wrapper_func(*args, **kwargs): | |||
# Prevent the Django caching middleware from caching | |||
# this response, as we want to cache it ourselves | |||
request._cache_update_cache = False | |||
key_prefix = get_cache_key(request) | |||
key_prefix = cache_key_func(request) |
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.
surprised by this... until I re-read the PR description
Summary
True
) this is returned from the lambda and assumed by Django to be a replacement response object to be returned instead of the original. Hilarity ensues.References
Fixes #11848
Reviewer guidance
Load an uncached contentnode API endpoint and confirm it does not return a 500.
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)