AllChangesIndexer: Don't abort when failing to open repository

Previously when opening project repositories during the reindexing
process, the program would be aborted if it failed to open the
repository. Instead, just log an error message and continue with
remaining projects.

Change-Id: I571dec2639f8f22bde0ec0460304a1f27f8d8fe9
This commit is contained in:
Borui Tao
2018-05-14 11:34:13 -04:00
committed by David Pursehouse
parent 0d9927c858
commit 83eaad4232

View File

@@ -118,15 +118,13 @@ public class AllChangesIndexer extends SiteIndexer<Change.Id, ChangeData, Change
pm.beginTask("Collecting projects", ProgressMonitor.UNKNOWN);
SortedSet<ProjectHolder> projects = new TreeSet<>();
int changeCount = 0;
Stopwatch sw = Stopwatch.createStarted();
for (Project.NameKey name : projectCache.all()) {
try (Repository repo = repoManager.openRepository(name)) {
int size = ChangeNotes.Factory.scan(repo).size();
changeCount += size;
projects.add(new ProjectHolder(name, size));
} catch (IOException e) {
log.error("Error collecting projects", e);
return new Result(sw, false, 0, 0);
log.error("Error collecting changes for project {}", name, e);
}
pm.update(1);
}