Details
-
Bug
-
Status: Resolved (View Workflow)
-
Major
-
Resolution: Fixed
Description
Encountered something like this in a thread dump:
"Handling GET /job/.../job/.../job/.../view/All/ from ... : RequestHandlerThread[#...] View/index.jelly View/sidepanel.jelly AbstractFolder/tasks-bottom.jelly" ... java.lang.Thread.State: RUNNABLE at java.lang.String$CaseInsensitiveComparator.compare(Unknown Source) at java.lang.String.compareToIgnoreCase(Unknown Source) at hudson.model.Items$2.compare(Items.java:360) at hudson.model.Items$2.compare(Items.java:358) at java.util.TimSort.countRunAndMakeAscending(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.ArrayList.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at hudson.model.Items.getAllItems(Items.java:358) at hudson.model.Items.getAllItems(Items.java:377) at hudson.model.Items.getAllItems(Items.java:377) at hudson.model.Items.getAllItems(Items.java:377) at hudson.model.Items.getAllItems(Items.java:353) at jenkins.model.Jenkins.getAllItems(Jenkins.java:1445) at jenkins.model.Jenkins.getAllItems(Jenkins.java:1454) at com.cloudbees.hudson.plugins.folder.relocate.StandardHandler.validDestinations(StandardHandler.java:85) at com.cloudbees.hudson.plugins.folder.relocate.StandardHandler.applicability(StandardHandler.java:54) at com.cloudbees.hudson.plugins.folder.relocate.DefaultRelocationUI.isAvailable(DefaultRelocationUI.java:67) at com.cloudbees.hudson.plugins.folder.relocate.RelocationAction.getIconFileName(RelocationAction.java:90)
This is silly. We are enumerating all items in the system, and sorting them, just so we can see if there is any place something could be moved into and thus whether we should display a Move link in the sidebar!
To start with, the sort is unnecessary. Not sure if core APIs currently allow this to be optimized out. Then we should have a lazy iterator and break at the first valid destination; there is no need to collect them all.
And perhaps we should just unconditionally display the link, at least if there is at least one top-level Folder in Jenkins. If there turns out to be no valid destination when you click the link, we can just show a message to that effect. No need to calculate all this in advance.
Attachments
Issue Links
- is duplicated by
-
JENKINS-45624 feature flag to use cloudbees-folder-plugin for dependency requirement
-
- Resolved
-
- links to
- mentioned in
-
Page Loading...
Code changed in jenkins
User: Jesse Glick
Path:
pom.xml
src/main/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolder.java
src/main/java/com/cloudbees/hudson/plugins/folder/computed/FolderCron.java
src/main/java/com/cloudbees/hudson/plugins/folder/computed/ThrottleComputationQueueTaskDispatcher.java
src/main/java/com/cloudbees/hudson/plugins/folder/relocate/StandardHandler.java
src/test/java/com/cloudbees/hudson/plugins/folder/relocate/StandardHandlerTest.java
http://jenkins-ci.org/commit/cloudbees-folder-plugin/533c71e20349cea16c0b67f51103c20018e42ead
Log:
Merge pull request #110 from jglick/hasValidDestination-
JENKINS-40612JENKINS-40612More efficient idiom for hasValidDestinationCompare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/84bdaaf3bbdd...533c71e20349