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 partial caching ignore repeated items issue #35145
Conversation
878a36b
to
0ea0bc6
Compare
@amatsuda are you willing to give this a quick scan if you have time? I'd really appreciate it 🙇 |
@@ -56,8 +60,11 @@ def collection_by_cache_keys(view, template) | |||
|
|||
digest_path = view.digest_path_from_template(template) | |||
|
|||
@ordered_keys = [] |
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.
Instead of building this instance variable here and using in other methods we should return it and pass around.
@rafaelfranca updated |
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.
Can you squash your commits?
This is because we only use hash to maintain the result. So when the key are the same, the result would be skipped. The solution is to maintain an array for tracking every item's position to restructure the result.
@rafaelfranca done |
In certain cases, the md5 and mtime value of a file is the same for multiple files. Only the file name differs in those cases. This needs to be considered, in order to have uniq data in the cache. In the past this lead to not show certain files in the webui due to this rails/rails#35145 Since this got fixed, it now does the opposite (showing duplicated entries), which is more obvious. Since osc shows the correct files, and missing files are less obvious than duplicates, this probably took a while to be reported as an issue. Fixes openSUSE#9352 Co-authored-by: David Kang <dkang@suse.com> Co-authored-by: Eduardo Navarro <enavarro@suse.com>
Summary
This is for #35114
Partial caching doesn't return the right collection when some of the items are repeated.
Let's say we have this template:
And a
cached_set
collection:On current master, the rendered result will be
The duplicated items are ignored.
This is because we only use hash to maintain the result. So when the key are the same, the result would be skipped.