This is an automated email from the ASF dual-hosted git repository.
dpavlov pushed a commit to branch ignite-9800
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git
The following commit(s) were added to refs/heads/ignite-9800 by this push:
new e590add IGNITE-9800: 2 types of actualization: first 2 pages & full
re-sync
e590add is described below
commit e590add59754f09282719015062413647c747279
Author: Dmitriy Pavlov <[email protected]>
AuthorDate: Sat Oct 6 17:34:34 2018 +0300
IGNITE-9800: 2 types of actualization: first 2 pages & full re-sync
---
.../ci/github/ignited/GitHubConnIgnitedImpl.java | 31 +++++++++++++++++-----
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
index 458462d..37221d1 100644
---
a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
+++
b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/github/ignited/GitHubConnIgnitedImpl.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@@ -60,6 +61,8 @@ class GitHubConnIgnitedImpl implements IGitHubConnIgnited {
private IgniteCache<Long, PullRequest> prCache;
+ private volatile boolean firstRun = true;
+
public void init(String srvId, IGitHubConnection conn) {
this.srvId = srvId;
this.conn = conn;
@@ -82,7 +85,7 @@ class GitHubConnIgnitedImpl implements IGitHubConnIgnited {
@AutoProfiling
@Override public List<PullRequest> getPullRequests() {
scheduler.sheduleNamed(IGitHubConnIgnited.class.getSimpleName() +
".actualizePrs",
- this::actualizePrs, 4, TimeUnit.MINUTES);
+ this::actualizePrs, 2, TimeUnit.MINUTES);
return StreamSupport.stream(prCache.spliterator(), false)
.filter(entry -> entry.getKey() >> 32 == srvIdMaskHigh)
@@ -99,26 +102,40 @@ class GitHubConnIgnitedImpl implements IGitHubConnIgnited {
}
private void actualizePrs() {
- runAtualizePrs(srvId);
+ runAtualizePrs(srvId, false);
+
+ // schedule full resync later
+ scheduler.sheduleNamed(IGitHubConnIgnited.class.getSimpleName() +
".fullReindex",
+ this::fullReindex, 60, TimeUnit.MINUTES);
+ }
+
+ private void fullReindex() {
+ runAtualizePrs(srvId, true);
}
/**
* @param srvId Server id.
+ * @param fullReindex Reindex all open PRs
*/
@MonitoredTask(name = "Actualize PRs", nameExtArgIndex = 0)
@AutoProfiling
- protected String runAtualizePrs(String srvId) {
+ protected String runAtualizePrs(String srvId, boolean fullReindex) {
AtomicReference<String> outLinkNext = new AtomicReference<>();
+
List<PullRequest> ghData = conn.getPullRequests(null, outLinkNext);
- int size = saveChunk(ghData);
+ int cntSaved = saveChunk(ghData);
+ int totalChecked = ghData.size();
while (outLinkNext.get() != null) {
String nextPageUrl = outLinkNext.get();
ghData = conn.getPullRequests(nextPageUrl, outLinkNext);
- size += saveChunk(ghData);
- }
+ cntSaved += saveChunk(ghData);
+ totalChecked += ghData.size();
+ if(!fullReindex)
+ break; // 2 pages
+ }
- return "Entries saved " + size;
+ return "Entries saved " + cntSaved + " PRs checked " + totalChecked;
}
private int saveChunk(List<PullRequest> ghData) {