void (@NotNull ProgressIndicator indicator) { if (myBigRepositoriesList.isBig(myRoot)) { LOG.info("Indexing repository " + myRoot.getName() + " is skipped"); markCommits(); myNumberOfTasks.get(myRoot).decrementAndGet(); return; } indicator.setIndeterminate(false); indicator.setFraction(0); mySpan = TelemetryManager.getInstance().getTracer(VcsScope).spanBuilder(VcsTelemetrySpan.LogIndex.Indexing.getName()).startSpan(); myScope = mySpan.makeCurrent(); myStartTime = getCurrentTimeMillis(); LOG.info("Indexing " + (myFull ? "full repository" : myCommits.size() + " commits") + " in " + myRoot.getName()); VcsLogStorageBackend indexStorageBackend = Objects.requireNonNull(myBackend); final var mutator = indexStorageBackend.createWriter(); boolean performCommit = false; try { if (myFull) { indexAll(indicator, mutator); } else { IntStream commits = myCommits.intStream().filter(c -> { if (isIndexed(c)) { myOldCommits.incrementAndGet(); return false; } return true; }); indexOneByOne(commits, indicator, mutator); } performCommit = true; } catch (AlreadyClosedException e) { throw new ProcessCanceledException(e); } catch (ProcessCanceledException e) { performCommit = true; scheduleReindex(); throw e; } catch (VcsException e) { if (indicator.isCanceled()) { performCommit = true; scheduleReindex(); throw new ProcessCanceledException(); } processException(e); scheduleReindex(); } finally { try { if (myDisposableFlag.isDisposed()) { mutator.interrupt(); } else { mutator.close(performCommit); } } catch (AlreadyClosedException | ProcessCanceledException ignored) { } catch (Exception e) { myErrorHandler.handleError(VcsLogErrorHandler.Source.Index, e); } myNumberOfTasks.get(myRoot).decrementAndGet(); myIndexingTime.get(myRoot).updateAndGet(t -> t + (getCurrentTimeMillis() - myStartTime)); boolean isIndexed = isIndexed(myRoot); if (isIndexed || myBigRepositoriesList.isBig(myRoot)) { long time = myIndexingTime.get(myRoot).getAndSet(0); myIndexCollector.reportIndexingTime(myRoot, time); if (isIndexed) myListeners.forEach(listener -> listener.indexingFinished(myRoot)); } report(); } }