Remove excessive injection stack from InitIndex
All this class needs to do is mark an empty index as ready. Factor out a small static method to do this work. Change-Id: Id0bcef9cb7e5a6879288ed4716ea45fb6539f07c
This commit is contained in:
@@ -134,6 +134,18 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
LUCENE_VERSIONS = versions.build();
|
||||
}
|
||||
|
||||
public static void setReady(SitePaths sitePaths, int version, boolean ready)
|
||||
throws IOException {
|
||||
try {
|
||||
FileBasedConfig cfg =
|
||||
LuceneVersionManager.loadGerritIndexConfig(sitePaths);
|
||||
LuceneVersionManager.setReady(cfg, version, ready);
|
||||
cfg.save();
|
||||
} catch (ConfigInvalidException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
static interface Factory {
|
||||
LuceneChangeIndex create(Schema<ChangeData> schema, String base);
|
||||
}
|
||||
@@ -304,13 +316,7 @@ public class LuceneChangeIndex implements ChangeIndex {
|
||||
|
||||
@Override
|
||||
public void markReady(boolean ready) throws IOException {
|
||||
try {
|
||||
FileBasedConfig cfg = LuceneVersionManager.loadGerritIndexConfig(sitePaths);
|
||||
LuceneVersionManager.setReady(cfg, schema.getVersion(), ready);
|
||||
cfg.save();
|
||||
} catch (ConfigInvalidException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
setReady(sitePaths, schema.getVersion(), ready);
|
||||
}
|
||||
|
||||
private static final ImmutableSet<String> FIELDS =
|
||||
|
Reference in New Issue
Block a user