You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2018/10/11 13:26:39 UTC

[ignite-teamcity-bot] branch master updated: Adaptive build iteration implemented.

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new a092bf9  Adaptive build iteration implemented.
a092bf9 is described below

commit a092bf913b1966fff0eab22d4160ddc3e87d5253
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Thu Oct 11 16:26:35 2018 +0300

    Adaptive build iteration implemented.
---
 .../org/apache/ignite/ci/di/MonitoredTask.java     |  2 +-
 .../ci/teamcity/ignited/TeamcityIgnitedImpl.java   | 33 +++++++++++-----------
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTask.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTask.java
index a5a1575..268d1cd 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTask.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/MonitoredTask.java
@@ -29,7 +29,7 @@ public @interface MonitoredTask {
     String name() default "";
 
     /**
-     * Argument index to be used to extend name.
+     * Argument index (0-based) to be used to extend name.
      */
     int nameExtArgIndex() default  -1;
 }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
index 2b8c830..54b3df4 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
@@ -71,10 +71,10 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
     }
 
     private void actualizeRecentBuilds() {
-        runAtualizeBuilds(srvId, false);
+        runAсtualizeBuilds(srvId, false);
 
         // schedule full resync later
-        scheduler.invokeLater(this::sheduleResync, 20, TimeUnit.SECONDS);
+        scheduler.invokeLater(this::sheduleResync, 60, TimeUnit.SECONDS);
     }
 
     /**
@@ -82,14 +82,14 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
      */
     private void sheduleResync() {
         scheduler.sheduleNamed(ITeamcityIgnited.class.getSimpleName() + ".fullReindex",
-            this::fullReindex, 60, TimeUnit.MINUTES);
+            this::fullReindex, 120, TimeUnit.MINUTES);
     }
 
     /**
      *
      */
     private void fullReindex() {
-        runAtualizeBuilds(srvId, true);
+        runAсtualizeBuilds(srvId, true);
     }
 
     /**
@@ -98,23 +98,24 @@ public class TeamcityIgnitedImpl implements ITeamcityIgnited {
      */
     @MonitoredTask(name = "Actualize BuildRefs, full resync", nameExtArgIndex = 1)
     @AutoProfiling
-    protected String runAtualizeBuilds(String srvId, boolean fullReindex) {
+    protected String runAсtualizeBuilds(String srvId, boolean fullReindex) {
         AtomicReference<String> outLinkNext = new AtomicReference<>();
-        int totalPages = 0;
-        List<BuildRef> tcData = conn.getBuildRefs(null, outLinkNext);
-        int cntSaved = buildRefDao.saveChunk(srvIdMaskHigh, tcData);
-        int totalChecked = tcData.size();
-        totalPages++;
+        List<BuildRef> tcDataFirstPage = conn.getBuildRefs(null, outLinkNext);
+
+        int cntSaved = buildRefDao.saveChunk(srvIdMaskHigh, tcDataFirstPage);
+        int totalChecked = tcDataFirstPage.size();
+
         while (outLinkNext.get() != null) {
             String nextPageUrl = outLinkNext.get();
             outLinkNext.set(null);
-            tcData = conn.getBuildRefs(nextPageUrl, outLinkNext);
-            cntSaved += buildRefDao.saveChunk(srvIdMaskHigh, tcData);
-            totalChecked += tcData.size();
-            totalPages++;
+            List<BuildRef> tcDataNextPage = conn.getBuildRefs(nextPageUrl, outLinkNext);
+            int savedCurChunk = buildRefDao.saveChunk(srvIdMaskHigh, tcDataNextPage);
+
+            cntSaved += savedCurChunk;
+            totalChecked += tcDataNextPage.size();
 
-            if (!fullReindex && totalPages >= 7)
-                break; // 7 pages, 700 builds
+            if (!fullReindex && savedCurChunk == 0)
+                break; // There are no modification at current page, hopefully no modifications at all
         }
 
         return "Entries saved " + cntSaved + " Builds checked " + totalChecked;