-
-
Notifications
You must be signed in to change notification settings - Fork 392
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
Proposals listing caching has broken the listing and searching under Rails 5.1 default configurations #7513
Comments
Looking at the version history, this might be related to proposal caching added at #6808 by @armandfardeau. Caching is generally "famous" for creating such issues along the way. The cache key generation looks like a potential source of the problem:
It uses Documentation or `cache_version says the following:
https://api.rubyonrails.org/classes/ActiveRecord/Integration.html#method-i-cache_version Not sure about this but it is one potential source for this. Maybe we could test temporarily disabling caching at Metadecidim to test this hypothesis? |
I am actually pretty sure this is cache related issue @armandfardeau. Proposal search is also broken at Metadecidim because of this issue. And I would expect a lot more issues around this. Rails default configurations for caching have changed in Rails 5.2:
Metadecidim is loading defaults from Rails 5.1: If you match the
And if this is nil, the cache key generation generates lots of potential duplicates: decidim/decidim-proposals/app/cells/decidim/proposals/proposal_m_cell.rb Lines 128 to 145 in fee1047
|
@ahukkanen independently of the defaults, this could be solved by adding the proposal ID to the cache key, right? |
@mrcasals Yes, I was looking at the module methods and there is also |
Ah, it looks good! Replacing |
@mrcasals Yes, I think so but would have to be tested. |
There is by the way another place too where
I don't think this would generate duplicates that easily because it calculates a digest of the hero block's attributes (which are likely to be different for different organizations) but just in case, maybe that should be changed too? |
Hi! Sorry for the mess I'm working on a fix. |
@mrcasals I believe you've deployed this already to Metadecidim? Because this issue still persists but I'm not sure if it's related to the cache key. |
@ahukkanen no, it's not deployed yet because it wasn't backported. I'll try to make the backport when I find a little time. |
@ahukkanen deployed already, seems to be working fine for me! |
Great @mrcasals, seems so to me as well! I think I might have found one more issue with this, though. I'll first confirm and then post a bug report (if I can confirm it). |
Describe the bug
When ordering the proposals with the "recent" ordering, the order seems broken (see the screenshot or go to see the issue at Metadecidim).
There are two separate issues regarding this that are most likely technically related:
There is also lots of other issues related to this. Basically there are collisions with the cache keys of the proposal cards (see comments below).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect the proposals to come ordered by their
created_at
dates when I change proposal ordering to "Recent".Screenshots
Stacktrace
No stacktrace,
the issue is most likely with the filtering or the base query used to fetch the records.EDIT: The issue is related to caching, see comments below.
Extra data (please complete the following information):
Additional context
Possibly incorrect joins in the query causing the results to get thecreated_at
date from some other record and causing the results to produce duplicates?Did not dig deeper, just seen similar issues in the past caused by incorrect joins.EDIT: The issue is related to caching, see comments below.
The text was updated successfully, but these errors were encountered: