[vcs-log] schedule reindexing on pce

This commit is contained in:
Julia Beliaeva
2017-07-26 00:38:00 +03:00
parent 06e546dd8b
commit be1f8a965d
@@ -500,13 +500,13 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable {
indicator.checkCanceled();
}
catch (ProcessCanceledException reThrown) {
taskCompleted(null);
throw reThrown;
}
catch (Throwable t) {
LOG.error("Error while indexing", t);
}
}
taskCompleted(null);
}
};
@@ -555,10 +555,13 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable {
indexOneByOne(commits, counter);
}
}
catch (ProcessCanceledException e) {
scheduleReindex();
throw e;
}
catch (VcsException e) {
LOG.error(e);
commits.forEach(value -> markForIndexing(value, myRoot));
scheduleIndex(false);
scheduleReindex();
}
}
finally {
@@ -580,6 +583,15 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable {
}
}
private void scheduleReindex() {
LOG.debug("Schedule reindexing of " + myCommits.size() + " commits in " + myRoot.getName());
myCommits.forEach(value -> {
markForIndexing(value, myRoot);
return true;
});
scheduleIndex(false);
}
private void indexOneByOne(@NotNull IntStream commits, @NotNull CommitsCounter counter) throws VcsException {
// We pass hashes to VcsLogProvider#readFullDetails in batches
// in order to avoid allocating too much memory for these hashes