]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7130 don't do select for aborted build twice per component
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 20 Jan 2016 14:22:49 +0000 (15:22 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 26 Jan 2016 15:18:41 +0000 (16:18 +0100)
sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java

index 88af87c4a3fbebbb35dc005ed6472f211925f6cf..d1c206a7452bf168407d3d552b92d25d397ce3ac 100644 (file)
@@ -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) {