Skip to content

Commit 3c3514f

Browse files
author
Vladimir Kotal
committed
endpoints calling into suggester should spawn a thread to become asynchronous
1 parent 2766179 commit 3c3514f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/ProjectsController.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ public void deleteProject(@PathParam("project") String projectName)
186186

187187
@DELETE
188188
@Path("/{project}/data")
189-
public void deleteProjectData(@PathParam("project") String projectName) throws HistoryException {
189+
public void deleteProjectData(@PathParam("project") String projectNameParam) {
190190
// Avoid classification as a taint bug.
191-
projectName = Laundromat.launderInput(projectName);
191+
final String projectName = Laundromat.launderInput(projectNameParam);
192192

193193
Project project = disableProject(projectName);
194194
logger.log(Level.INFO, "deleting data for project {0}", projectName);
@@ -206,7 +206,7 @@ public void deleteProjectData(@PathParam("project") String projectName) throws H
206206
deleteHistoryCache(projectName);
207207

208208
// Delete suggester data.
209-
suggester.delete(projectName);
209+
new Thread(() -> suggester.delete(projectName)).start();
210210
}
211211

212212
@DELETE
@@ -246,9 +246,9 @@ public void deleteHistoryCache(@PathParam("project") String projectName) {
246246
@PUT
247247
@Path("/{project}/indexed")
248248
@Consumes(MediaType.TEXT_PLAIN)
249-
public void markIndexed(@PathParam("project") String projectName) throws Exception {
249+
public void markIndexed(@PathParam("project") String projectNameParam) throws Exception {
250250
// Avoid classification as a taint bug.
251-
projectName = Laundromat.launderInput(projectName);
251+
final String projectName = Laundromat.launderInput(projectNameParam);
252252

253253
Project project = env.getProjects().get(projectName);
254254
if (project == null) {
@@ -272,7 +272,8 @@ public void markIndexed(@PathParam("project") String projectName) throws Excepti
272272
}
273273
}
274274
}
275-
suggester.rebuild(projectName);
275+
276+
new Thread(() -> suggester.rebuild(projectName)).start();
276277

277278
// In case this project has just been incrementally indexed,
278279
// its IndexSearcher needs a poke.

0 commit comments

Comments
 (0)