-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Fix pagination in Content Delivery API Index Helper #19606
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
Conversation
Improved loop condition to allow for processing of more than 10.000 descendants for indexing.
Hi there @Brynjarth, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
Hi @Brynjarth Thanks for your PR to resolve #18683 with the maximum amount of results. One of the core contributors team will take a look - I think it's one HQ might want to confirm too since it was in discussion on the issue thread too. Cheers, Emma |
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.
I'm struggling to see here what the problem was the original code, which makes me nervous to accept the change, even if verified in production, without having understood where the issue was.
Can you help me understand the logic error with the original code please?
Let's assume 25000 documents.
First time through, pageIndex
= 0, pageSize
= 10000 - retrieves 10000 records, so descendants.Length == pageSize
and we loop again with pageIndex
incremented.
Second time through, pageIndex
= 1, pageSize
= 10000 - retrieves a second batch of 10000 records, so descendants.Length == pageSize
and we loop again with pageIndex
incremented.
Third time through, pageIndex
= 2, pageSize
= 10000 - retrieves the last 5000 records, so descendants.Length != pageSize
and we stop.
Hi Andy, Its actually this that fixes the issue: The problem is that the current code is looking for an exact match But My guess is that only this index has this specific where command and why its the only one breaking and not the other ones. This means that only projects with higher then 10000 nodes and are using the DisallowedContentTypeAliases feature are having this issue. This is tested with version 13.8.1 |
Thanks @gardarthorsteins for the explanation - makes sense. I added an initially failing integration test to first ensure we could replicate the problem via that means, and then to verify your implementation, which looks to work as expected. |
* Refactor descendant enumeration in DeliveryApiContentIndexHelper Improved loop condition to allow for processing of more than 10.000 descendants for indexing. * Add failing test for original issue. * Renamed variable for clarity. --------- Co-authored-by: Brynjar Þorsteinsson <brynjar@vettvangur.is> Co-authored-by: Andy Butland <abutland73@gmail.com>
Resolves: #18683
Description
When rebuilding the Content Delivery API Index it only fetches 10.000 descendants at maximum currently. The logic that was used was flawed and was always stopping at 10.000 items.
This fix updates the logic so that it can fetch all of the descendants and insert them into the index.
We tested this on our own website and this fix is currently working in production.