diff options
author | Harald Musum <musum@yahooinc.com> | 2023-06-12 14:11:49 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2023-06-12 14:11:49 +0200 |
commit | 8dbfc94b01ea4a2dc17bd35df3b49f279c2b07ab (patch) | |
tree | a89682a4bb8d9a495648e4d52115fd5fc590096c /container-search | |
parent | 5d42ad8a6ea453c129452cdc23311b6b191ad10a (diff) |
Always log when failing to process file
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/logging/Spooler.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/logging/Spooler.java b/container-search/src/main/java/com/yahoo/search/logging/Spooler.java index e6d5bfc59ff..921b8f444f1 100644 --- a/container-search/src/main/java/com/yahoo/search/logging/Spooler.java +++ b/container-search/src/main/java/com/yahoo/search/logging/Spooler.java @@ -38,6 +38,7 @@ public class Spooler { private static final int defaultMaxEntriesPerFile = 100; // Maximum delay between first write to a file and when we should close file and move it for further processing static final Duration maxDelayAfterFirstWrite = Duration.ofSeconds(5); + private static final int maxFilesToRead = 50; private Path processingPath; private Path readyPath; @@ -89,7 +90,7 @@ public class Spooler { } log.log(Level.FINE, "Files in ready path: " + files.size()); - List<File> fileList = getFiles(files, 50); // TODO + List<File> fileList = getFiles(files); if ( ! fileList.isEmpty()) { processFiles(fileList, transport); } @@ -145,6 +146,8 @@ public class Spooler { if (failCount > maxFailures) { log.log(Level.WARNING, "Unable to process file " + file + " after trying " + maxFailures + " times, moving it to " + failuresPath); moveProcessedFile(file, failuresPath); + } else { + log.log(Level.INFO, "Unable to process file " + file + " after trying " + maxFailures + " times, will retry"); } } @@ -163,8 +166,8 @@ public class Spooler { public Path successesPath() { return successesPath; } public Path failuresPath() { return failuresPath; } - List<File> getFiles(List<Path> files, int count) { - Validation.requireAtLeast(count, "count must be a positive number", 1); + List<File> getFiles(List<Path> files) { + Validation.requireAtLeast(maxFilesToRead, "count must be a positive number", 1); List<File> fileList = new ArrayList<>(); for (Path p : files) { @@ -174,7 +177,7 @@ public class Spooler { } // Grab only some files - if (fileList.size() > count) { + if (fileList.size() > maxFilesToRead) { break; } } |