Skip to content
Permalink
Browse files

Fix file access issue in production

See #117
  • Loading branch information...
fsteeg committed Jun 15, 2018
1 parent c88d0cd commit 58784cd8b51533a78af2eb0ea75ce8f44820ef41
Showing with 9 additions and 5 deletions.
  1. +9 −5 app/modules/IndexComponent.java
@@ -15,6 +15,7 @@
import java.nio.file.Paths;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.Scanner;
import java.util.stream.Collectors;

import javax.inject.Inject;
@@ -118,11 +119,14 @@ private void startup() {
private void deleteDeprecatedResources() throws IOException {
File file = new File(config("index.delete"));
if (file.exists()) {
Files.lines(Paths.get(file.toURI())).forEach(id -> {
DeleteResponse response = client.prepareDelete(config("index.name"), config("index.type"), id).execute()
.actionGet();
Logger.debug("Deletion status {}: {}", response.status(), response);
});
try (Scanner s = new Scanner(new FileInputStream(file))) {
while (s.hasNextLine()) {
String id = s.nextLine();
DeleteResponse response = client.prepareDelete(config("index.name"), config("index.type"), id)
.execute().actionGet();
Logger.info("Delete {}: {}", id, response.status());
}
}
client.admin().indices().refresh(new RefreshRequest()).actionGet();
}
}

0 comments on commit 58784cd

Please sign in to comment.
You can’t perform that action at this time.