-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Number of existing media items is counted wrong in NuCacheContentRepository which leads to media not being cached properly #15205
Comments
Hi there @karl-sjogren! Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better. We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
Can you confirm this query returns the expected number of media SELECT COUNT(*) FROM (
SELECT "umbracoNode"."id" AS "Id"
FROM "umbracoNode"
INNER JOIN "umbracoContent"
ON ("umbracoNode"."id" = "umbracoContent"."nodeId")
INNER JOIN "umbracoContentVersion"
ON (("umbracoNode"."id" = "umbracoContentVersion"."nodeId") AND "umbracoContentVersion"."current" = 1)
WHERE ((("umbracoNode"."nodeObjectType" = 'B796F64C-1F99-4FFB-B886-4BF4BC011A9C') AND ("umbracoNode"."trashed" = 0)))
) npoco_tbl |
Yes that returns the correct number when I run it against my database. |
* #15205 Count media correct * Fix content should be document
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
12.3.2
Bug summary
This is a follow up issue to #15195 where not all media was populated into the cache and thus not available on the site. A fix for #15195 was made in release 12.3.2 but it didn't help.
The work around from the previous issue still works, ie disabling the new feature that uses a paged query when populating the cache.
Specifics
As the initial reporter of #15195 I took some time to debug this again on 12.3.2 and the "Count" query just doesn't work for media items it seems. In my tests it always returns 0 items, but since the check is made after loading the first page at least some stuff still loaded.
I'm still something of a beginner with the low level Umbraco (and NPoco) stuff but the count query is waaay different then the actual select in this case.
This is the generated query to select all media items:
And this is the (supposedly optimized) query to count the items which returns 0.
If we were to skip this optimized count query for Media the result is correct. Something like this.
I have no idea if there are other types that needs to be handled here as well but this solved my images not loading. Since it is only for the count query I can't see that this affects the performance to badly, at least for short term fix.
Steps to reproduce
Add more then 1000 media items and less then 1000 documents, only the first 1000 media items will be loaded into the cache.
Expected result / actual result
All media items should be loaded into the cache no matter how many documents there are.
The text was updated successfully, but these errors were encountered: