Skip to content

Commit e4ce24b

Browse files
committed
force a refresh on startup and after updates
This makes data available and fixes indexes in a semi-available state.
1 parent 438c511 commit e4ce24b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/main/java/de/komoot/photon/App.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static void main(String[] rawArgs) throws Exception {
5353
// Working on an existing installation.
5454
// Update the index settings in case there are any changes.
5555
esServer.updateIndexSettings(args.getSynonymFile());
56-
esServer.waitForReady();
56+
esServer.refreshIndexes();
5757

5858
if (args.isNominatimUpdate()) {
5959
shutdownES = true;

src/main/java/de/komoot/photon/elasticsearch/Server.java

+5
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ public void waitForReady() {
126126
esClient.admin().cluster().prepareHealth().setWaitForYellowStatus().get();
127127
}
128128

129+
public void refreshIndexes() {
130+
esClient.admin().cluster().prepareHealth().setWaitForYellowStatus().get();
131+
esClient.admin().indices().prepareRefresh(PhotonIndex.NAME).get();
132+
}
133+
129134
/**
130135
* stops the elasticsearch node
131136
*/

src/main/java/de/komoot/photon/elasticsearch/Updater.java

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public Updater(Client esClient, String[] languages, String[] extraTags) {
2929

3030
public void finish() {
3131
this.updateDocuments();
32+
esClient.admin().indices().prepareRefresh(PhotonIndex.NAME).get();
3233
}
3334

3435
@Override

0 commit comments

Comments
 (0)