Skip to content

Commit fd1c363

Browse files
authored
remove /system/refresh API endpoint (#3940)
fixes #3934
1 parent 2fdccfd commit fd1c363

File tree

4 files changed

+4
-64
lines changed

4 files changed

+4
-64
lines changed

apiary.apib

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,6 @@ The time is in the ISO 8601 format in UTC time zone.
209209

210210
"2021-02-15T16:39:16.409+00:00"
211211

212-
## Index searchers refresh [/system/refresh]
213-
214-
### refreshes index searchers for specified project [PUT]
215-
216-
+ Request (text/plain)
217-
+ Body
218-
219-
project name to refresh
220-
221-
+ Response 204
222-
223212
## Messages [/messages{?tag}]
224213

225214
### adds message to a system [POST]

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/RuntimeEnvironment.java

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,34 +1485,6 @@ public void writeConfiguration(String host) throws IOException, InterruptedExcep
14851485
}
14861486
}
14871487

1488-
/**
1489-
* Send message to webapp to refresh SearcherManagers for given projects.
1490-
* This is used for partial reindex.
1491-
*
1492-
* @param subFiles list of directories to refresh corresponding SearcherManagers
1493-
* @param host the host address to receive the configuration
1494-
*/
1495-
public void signalTorefreshSearcherManagers(List<String> subFiles, String host) {
1496-
// subFile entries start with path separator so get basename
1497-
// to convert them to project names.
1498-
1499-
subFiles.stream().map(proj -> new File(proj).getName()).forEach(project -> {
1500-
Response r = ClientBuilder.newClient()
1501-
.target(host)
1502-
.path("api")
1503-
.path("v1")
1504-
.path("system")
1505-
.path("refresh")
1506-
.request()
1507-
.headers(getWebAppHeaders())
1508-
.put(Entity.text(project));
1509-
1510-
if (r.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
1511-
LOGGER.log(Level.WARNING, "Could not refresh search manager for {0}", project);
1512-
}
1513-
});
1514-
}
1515-
15161488
/**
15171489
* Generate a TreeMap of projects with corresponding repository information.
15181490
* <p>

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,9 @@ public static void main(String[] argv) {
385385

386386
writeConfigToFile(env, configFilename);
387387

388-
// Finally, ping webapp to refresh indexes in the case of partial reindex
389-
// or send new configuration to the web application in the case of full reindex.
390-
if (webappURI != null) {
391-
if (!subFiles.isEmpty()) {
392-
getInstance().refreshSearcherManagers(env, subFiles, webappURI);
393-
} else {
394-
getInstance().sendToConfigHost(env, webappURI);
395-
}
388+
// Finally, send new configuration to the web application in the case of full reindex.
389+
if (webappURI != null && subFiles.isEmpty()) {
390+
getInstance().sendToConfigHost(env, webappURI);
396391
}
397392

398393
env.getIndexerParallelizer().bounce();
@@ -1158,12 +1153,6 @@ public void doIndexerExecution(final boolean update, List<String> subFiles,
11581153
CtagsUtil.deleteTempFiles();
11591154
}
11601155

1161-
public void refreshSearcherManagers(RuntimeEnvironment env, List<String> projects, String host) {
1162-
LOGGER.log(Level.INFO, "Refreshing searcher managers to: {0}", host);
1163-
1164-
env.signalTorefreshSearcherManagers(projects, host);
1165-
}
1166-
11671156
public void sendToConfigHost(RuntimeEnvironment env, String host) {
11681157
LOGGER.log(Level.INFO, "Sending configuration to: {0}", host);
11691158
try {

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.web.api.v1.controller;
2424
import jakarta.inject.Inject;
@@ -41,10 +41,8 @@
4141
import org.opengrok.web.api.v1.suggester.provider.service.SuggesterService;
4242

4343
import java.io.IOException;
44-
import java.util.Collections;
4544
import java.util.Date;
4645
import java.util.Set;
47-
import java.util.concurrent.CompletableFuture;
4846
import java.util.logging.Level;
4947
import java.util.logging.Logger;
5048

@@ -58,14 +56,6 @@ public class SystemController {
5856
@Inject
5957
private SuggesterService suggester;
6058

61-
@PUT
62-
@Path("/refresh")
63-
@Consumes(MediaType.TEXT_PLAIN)
64-
public void refresh(final String project) {
65-
env.maybeRefreshIndexSearchers(Collections.singleton(project));
66-
CompletableFuture.runAsync(() -> suggester.rebuild(project));
67-
}
68-
6959
@PUT
7060
@Path("/includes/reload")
7161
public void reloadIncludes() {

0 commit comments

Comments
 (0)