]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 - Added implicit commit based on action count (commits at 200 actions)
authorStephane Gamard <stephane.gamard@searchbox.com>
Thu, 12 Jun 2014 18:06:12 +0000 (20:06 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Thu, 12 Jun 2014 18:06:12 +0000 (20:06 +0200)
sonar-core/src/main/java/org/sonar/core/persistence/DbSession.java

index fb07e58884578dae3133094ce830ff1ab93088ea..10e82b803cc3d520f0ca7e90947e06affd7d1589 100644 (file)
@@ -34,6 +34,7 @@ import java.util.Map;
 
 public class DbSession implements SqlSession {
 
+  private static final Integer IMPLICIT_COMMIT_SIZE = 200;
   private List<QueueAction> actions;
 
   private WorkQueue queue;
@@ -47,6 +48,9 @@ public class DbSession implements SqlSession {
 
   public void enqueue(QueueAction action) {
     this.actions.add(action);
+    if (this.actions.size() > IMPLICIT_COMMIT_SIZE) {
+      this.commit();
+    }
   }
 
   @Override