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

Improve performance for calculating breaches #101

Merged
merged 5 commits into from May 2, 2024
Merged

Conversation

pgrunewald
Copy link
Contributor

See #100

@mister-roboto
Copy link

@pgrunewald thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@@ -67,7 +69,9 @@ def get_breaches(self, items=None):
"No object found for %s! Skipping", brain_to_delete
)
continue
for breach in self.get_breaches_for_item(obj):
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if I read the code correctly but shouldn't this check the breach of the obj_to_delete instead of the obj ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because get_breaches_for_item does collect all the breaches for all the children, see https://github.com/plone/plone.app.linkintegrity/blob/master/plone/app/linkintegrity/browser/info.py#L138-L139.

But then again, obj_to_delete does not really do anything here. Now looking at it, there could be more improvements implemention-wise.

Copy link
Member

@petschki petschki Apr 9, 2024

Choose a reason for hiding this comment

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

ouch ... I think there is something like "depth": 1 missing in the get_breaches_for_item catalog path query ... otherwise the recursive lookup does things multiple times for the same folder.

Copy link
Contributor Author

@pgrunewald pgrunewald Apr 9, 2024

Choose a reason for hiding this comment

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

Oh, I see. Looking up the same items multiple times is really unnecessary. I will rewrite those parts even further.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@petschki I have rewritten a good chunk of the code, while maintaining backwards compatibility. In the Plone code base I just found usages for get_breaches. In case anyone uses in their 3rd party add-on the other methods, they should still be able to do so.

@pgrunewald
Copy link
Contributor Author

@jenkins-plone-org please run jobs

@jensens jensens requested a review from petschki April 19, 2024 16:24
@jensens jensens merged commit 1cf1945 into master May 2, 2024
13 checks passed
@jensens jensens deleted the performance_speedup branch May 2, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants