@Override protected Future schedule(AbstractBuild<?, ?> build, Job project, List<Action> list, TaskListener listener) throws InterruptedException, IOException { if (block!=null) { while (true) { // add DifferentiatingAction to make sure this doesn't get merged with something else, // which is most likely unintended. Might make sense to do it at BuildTriggerConfig for all. list = ImmutableList.<Action>builder().addAll(list).add(new DifferentiatingAction()).build(); // if we fail to add the item to the queue, wait and retry. // it also means we have to force quiet period = 0, or else it'll never leave the queue Future f = schedule(build, project, 0, list, listener); // When a project is disabled or the configuration is not yet saved f will always be null and we're caught in a loop, therefore we need to check for it if (f!=null || (f==null && !canBeScheduled(project))){ return f; } Thread.sleep(1000); } } else { return super.schedule(build,project,list,listener); } }
if(!config.canBeScheduled(p)){ listener.getLogger().println("Skipping " + HyperlinkNote.encodeTo('/'+ p.getUrl(), p.getFullDisplayName()) + ". The project is either disabled,"