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

Fix feedback cache invalidation #1287

Merged
merged 1 commit into from
Mar 18, 2022
Merged

Fix feedback cache invalidation #1287

merged 1 commit into from
Mar 18, 2022

Conversation

melegiul
Copy link
Contributor

@melegiul melegiul commented Mar 10, 2022

Short description

Fix feedback cache invalidation

Proposed changes

django-cacheops does not support multi-table inheritance (Suor/django-cacheops#31)
The suggested workaround is to use signal handlers to invalidate the cache manually (Suor/django-cacheops#31 (comment)), so signal handlers are used to invalidate the cache on feedback creation and deletion.
But marking feedback as read/unread uses the query set update method and does not trigger a save signal, so in case of feedback updates cache invalidation is performed in the view instead.

Resolved issues

Fixes: #1282

@melegiul melegiul force-pushed the bugfix/feedback-cache branch from 412333a to b39d2b6 Compare March 10, 2022 16:31
@timobrembeck timobrembeck added prio: medium Should be scheduled in the forseeable future. prio: low Not urgent, can be resolved in the distant future. and removed prio: medium Should be scheduled in the forseeable future. labels Mar 11, 2022
@melegiul melegiul force-pushed the bugfix/feedback-cache branch 2 times, most recently from f9e43ca to 1247abb Compare March 17, 2022 09:42
@codeclimate
Copy link

codeclimate bot commented Mar 17, 2022

Code Climate has analyzed commit 03a332b and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 46.9% (50% is the threshold).

This pull request will bring the total coverage in the repository to 73.0% (-0.2% change).

View more on Code Climate.

@melegiul melegiul marked this pull request as ready for review March 17, 2022 09:53
@melegiul melegiul requested a review from a team as a code owner March 17, 2022 09:53
Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

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

Thanks a lot, works exactly as expected! 💪
I'd just adapt the file name.

integreat_cms/cms/signals/FeedbackUpdateHandler.py Outdated Show resolved Hide resolved
- Cache invalidation via signals on feedback creation and deletion
- Cache invalidation in views on feedback update
@melegiul melegiul force-pushed the bugfix/feedback-cache branch from 1247abb to 03a332b Compare March 18, 2022 08:32
Copy link
Member

@timobrembeck timobrembeck left a comment

Choose a reason for hiding this comment

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

Thanks! 🚀

@melegiul melegiul merged commit d976288 into develop Mar 18, 2022
@melegiul melegiul deleted the bugfix/feedback-cache branch March 18, 2022 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: low Not urgent, can be resolved in the distant future.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache not invalidated when feedback changes
2 participants