Skip to content

Commit

Permalink
Merge pull request #793 from lonvia/refresh-on-start
Browse files Browse the repository at this point in the history
Force a refresh on startup and after updates
  • Loading branch information
lonvia authored Apr 19, 2024
2 parents 438c511 + e4ce24b commit 15d9a70
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/de/komoot/photon/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void main(String[] rawArgs) throws Exception {
// Working on an existing installation.
// Update the index settings in case there are any changes.
esServer.updateIndexSettings(args.getSynonymFile());
esServer.waitForReady();
esServer.refreshIndexes();

if (args.isNominatimUpdate()) {
shutdownES = true;
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/de/komoot/photon/elasticsearch/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ public void waitForReady() {
esClient.admin().cluster().prepareHealth().setWaitForYellowStatus().get();
}

public void refreshIndexes() {
esClient.admin().cluster().prepareHealth().setWaitForYellowStatus().get();
esClient.admin().indices().prepareRefresh(PhotonIndex.NAME).get();
}

/**
* stops the elasticsearch node
*/
Expand Down
1 change: 1 addition & 0 deletions src/main/java/de/komoot/photon/elasticsearch/Updater.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public Updater(Client esClient, String[] languages, String[] extraTags) {

public void finish() {
this.updateDocuments();
esClient.admin().indices().prepareRefresh(PhotonIndex.NAME).get();
}

@Override
Expand Down

0 comments on commit 15d9a70

Please sign in to comment.