mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
Bit of performance optimization.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@8355 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
7c4abd909a
commit
f85cf3e84b
1 file changed
+12
-1
@@ -411,12 +411,23 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
|
||||
public String getWhyKeepLog() {
|
||||
// if any of the downstream project is configured with 'keep dependency component',
|
||||
// we need to keep this log
|
||||
OUTER:
|
||||
for (AbstractProject<?,?> p : getParent().getDownstreamProjects()) {
|
||||
if(!p.isKeepDependencies()) continue;
|
||||
|
||||
AbstractBuild<?, ?> fb = p.getFirstBuild();
|
||||
if(fb==null) continue; // no active record
|
||||
|
||||
// is there any active build that depends on us?
|
||||
for(int i : getDownstreamRelationship(p).listNumbersReverse()) {
|
||||
// TODO: this is essentially a "find intersection between two sparse sequences"
|
||||
// and we should be able to do much better.
|
||||
|
||||
if(i<fb.getNumber())
|
||||
continue OUTER; // all the other records are younger than the first record, so pointless to search.
|
||||
|
||||
AbstractBuild<?, ?> b = p.getBuildByNumber(i);
|
||||
if(b!=null && b.isKeepLog())
|
||||
if(b!=null)
|
||||
return Messages.AbstractBuild_KeptBecause(b);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user