aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-01-20 15:22:49 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-01-26 16:18:41 +0100
commit26827c6fa0061b4294cdde744c5c2d5c74072fbd (patch)
treeab964c45a261e605530a1998d5e668448f4bafa3
parenta247cdab18befbdbf4cc3ebf692053a845d24dc4 (diff)
downloadsonarqube-26827c6fa0061b4294cdde744c5c2d5c74072fbd.tar.gz
sonarqube-26827c6fa0061b4294cdde744c5c2d5c74072fbd.zip
SONAR-7130 don't do select for aborted build twice per component
-rw-r--r--sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java16
1 files changed, 3 insertions, 13 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java b/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java
index 88af87c4a3f..d1c206a7452 100644
--- a/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java
+++ b/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java
@@ -89,22 +89,12 @@ public class PurgeDao implements Dao {
}
private static void deleteAbortedBuilds(ResourceDto project, PurgeCommands commands) {
- if (hasAbortedBuilds(project.getId(), commands)) {
- LOG.debug("<- Delete aborted builds");
- PurgeSnapshotQuery query = PurgeSnapshotQuery.create()
- .setIslast(false)
- .setStatus(new String[] {"U"})
- .setRootProjectId(project.getId());
- commands.deleteSnapshots(query);
- }
- }
-
- private static boolean hasAbortedBuilds(Long projectId, PurgeCommands commands) {
+ LOG.debug("<- Delete aborted builds");
PurgeSnapshotQuery query = PurgeSnapshotQuery.create()
.setIslast(false)
.setStatus(new String[] {"U"})
- .setResourceId(projectId);
- return !commands.selectSnapshotIds(query).isEmpty();
+ .setRootProjectId(project.getId());
+ commands.deleteSnapshots(query);
}
private static void purge(ResourceDto project, String[] scopesWithoutHistoricalData, PurgeCommands purgeCommands) {