Instead of refilling the cache every x minutes you could implement an https://javadoc.jenkins.io/hudson/model/listeners/ItemListener.html to react on job changes. This would avoid the problem mentioned in issue 302.
You would need to implement onloaded(), onUpdated(), onCreated() and onDeleted() probably. Maybe also onCopied() and onLocationChanged() depending how you internally manage the data in the cache (instead of a list you would need a map<String, ParameterizedJob> with job fullname as key).
When you have your jobs organized in folders then the getAllItems could probably be made faster by loading each folder in its own thread. But with the above approach you would need to do this only once at startup so probably not worth the effort.
Regarding https://github.com/jenkinsci/generic-webhook-trigger-plugin/pull/273#pullrequestreview-1585610771
You could also investigate making your plugin extensible via an ExtensionPoint. So when others see the need for a different implementation, they could write their own plugin that just implements the ExtensionPoint
From: jenkin...@googlegroups.com <jenkin...@googlegroups.com>
On Behalf Of Tomas Bjerre
Sent: Samstag, 13. April 2024 07:13
To: Jenkins Developers <jenkin...@googlegroups.com>
Subject: Jenkins.getInstance().getAllItems(ParameterizedJob.class) slow in large installations
You don't often get email from tomas.b...@gmail.com. Learn why this is important |
--
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
jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/cbea2c0c-efa3-4ef2-813b-d8ee3658500an%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/w-jdCAtGh20/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/AS1PR02MB78471557F788B420E66A9BB6870B2%40AS1PR02MB7847.eurprd02.prod.outlook.com.
- Is there a faster way to Jenkins.getInstance().getAllItems(ParameterizedJob.class); ?
Indeed it sems that when posting an xml to update a job the ItemListener.onUpdated is not called. Only the Saveablelistener is called:
While when creating a job then ItemListener.onCreated is called but not the SaveableListener.onChange (well actually it is not a change so this is probably ok)
I don’t know how JobDSL works internally but if it is also posting an xml and thus also calling the updateByXML method then it is the same root cause. Implementing also the SaveableListener might do the trick.
I would consider this a bug in core, but maybe others think it works as designed though.
From: jenkin...@googlegroups.com <jenkin...@googlegroups.com>
On Behalf Of Tomas Bjerre
Sent: Donnerstag, 23. Mai 2024 18:18
To: Jenkins Developers <jenkin...@googlegroups.com>
Subject: Re: Jenkins.getInstance().getAllItems(ParameterizedJob.class) slow in large installations
You don't often get email from tomas.b...@gmail.com. Learn why this is important |
I implemented and released Markus solution 2024-04-14. There are now 2 issues as a result of this change:
--
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
jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5d851a22-9803-4b90-a905-4dca95817531n%40googlegroups.com.
when posting an xml to update a job the ItemListener.onUpdated is not called. Only the Saveablelistener is called