On Sat, Apr 13, 2024 at 1:13 AM Tomas Bjerre <[email protected]>
wrote:

> - Is there a faster way
> to Jenkins.getInstance().getAllItems(ParameterizedJob.class); ?
>

Yes,
https://javadoc.jenkins.io/hudson/model/ItemGroup.html#allItems(java.lang.Class)
is faster since it avoids the need to sort. Also if this code is running as
a particular user identity yet the particular block of logic should apply
regardless of the user’s permissions to learn of the existence of
particular jobs, you can impersonate `ACL.SYSTEM` which will be faster
since a typical `AuthorizationStrategy` implementation has a quick path for
this principal.

Without knowing what the plugin does or why it is enumerating all projects
in a performance-sensitive call site, I cannot offer further advice, but
creating a cache smells like a poor solution. Can the plugin be redesigned
to look up the required project by name rather than conducting a search?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr14JQ-4HvKu-S04_NOo1dtQdEZV6rTwVbKiXmjDX8nVSA%40mail.gmail.com.

Reply via email to