Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[FIXED JENKINS-22934] Show poll thread count option when necessary.
* Show the option when the configured value is not the default
* Show the option even when projects are in other ItemGroups
* Only consider AbstractProjects
Loading branch information
@@ -45,6 +45,8 @@
import hudson.util.SequentialExecutionQueue ;
import org.apache.commons.io.FileUtils ;
import org.apache.commons.jelly.XMLOutput ;
import org.kohsuke.accmod.Restricted ;
import org.kohsuke.accmod.restrictions.NoExternalUse ;
import org.kohsuke.stapler.StaplerRequest ;
import org.kohsuke.stapler.DataBoundConstructor ;
@@ -260,6 +262,15 @@ public void setPollingThreadCount(int n) {
resizeThreadPool();
}
@Restricted (NoExternalUse . class)
public boolean isPollingThreadCountOptionVisible () {
// unless you have a fair number of projects, this option is likely pointless.
// so let's hide this option for new users to avoid confusing them
// unless it was already changed
return Jenkins . getInstance(). getAllItems(AbstractProject . class). size() > 10
|| getPollingThreadCount() != 0 ;
}
/**
* Update the {@link ExecutorService} instance.
*/
@@ -24,11 +24,7 @@ THE SOFTWARE.
<?jelly escape-by-default =' true' ?>
<j : jelly xmlns : j =" jelly:core" xmlns : st =" jelly:stapler" xmlns : d =" jelly:define" xmlns : l =" /lib/layout" xmlns : t =" /lib/hudson" xmlns : f =" /lib/form" >
<j : if test =" ${app.items.size()>10}" >
<!--
unless you have a fair number of projects, this option is likely pointless.
so let's hide this option for new users to avoid confusing them.
-->
<j : if test =" ${descriptor.pollingThreadCountOptionVisible}" >
<f : section title =" ${%SCM Polling}" >
<f : entry title =" ${%Max # of concurrent polling}" field =" pollingThreadCount" >
<f : number value =" ${descriptor.pollingThreadCount==0 ? '' : descriptor.pollingThreadCount}"
Toggle all file notes
Toggle all file annotations