Skip to content

Commit 433284d

Browse files
author
Vladimir Kotal
committed
address review comments
1 parent 1f303e2 commit 433284d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexCheck.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ public static void checkDir(File dir) throws IndexVersionException, IOException
135135
int segVersion;
136136

137137
try (Directory indexDirectory = FSDirectory.open(dir.toPath(), lockFactory)) {
138-
SegmentInfos segInfos;
139-
140-
segInfos = SegmentInfos.readLatestCommit(indexDirectory);
138+
SegmentInfos segInfos = SegmentInfos.readLatestCommit(indexDirectory);
141139
segVersion = segInfos.getIndexCreatedVersionMajor();
142140
}
143141

opengrok-web/src/main/java/org/opengrok/web/WebappListener.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
105105
}
106106

107107
// Check index(es).
108+
check_index(env);
109+
110+
env.startExpirationTimer();
111+
startupTimer.record(Duration.between(start, Instant.now()));
112+
}
113+
114+
/**
115+
* Checks the index(es). If projects are enabled then each project with invalid index
116+
* is marked as not being indexed.
117+
* @param env runtime environment
118+
*/
119+
private void check_index(RuntimeEnvironment env) {
108120
if (env.isProjectsEnabled()) {
109121
LOGGER.log(Level.FINE, "Checking indexes for all projects");
110122
Map<String, Project> projects = env.getProjects();
@@ -130,9 +142,6 @@ public void contextInitialized(final ServletContextEvent servletContextEvent) {
130142
}
131143
LOGGER.log(Level.FINE, "Index check done");
132144
}
133-
134-
env.startExpirationTimer();
135-
startupTimer.record(Duration.between(start, Instant.now()));
136145
}
137146

138147
/**

0 commit comments

Comments
 (0)