Skip to content

Commit

Permalink
* log-exporter: replace "rm -rf" with "find -delete"
Browse files Browse the repository at this point in the history
Signed-off-by: neo <1100909+neowu@users.noreply.github.com>
  • Loading branch information
neowu committed Nov 1, 2024
1 parent 4530f97 commit c3467fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* http_client: use 1 hour TTL for fallback dns cache
> report error for permanent DNS issue after 1 hour
* jre: published neowu/jre:21.0.5
* log-exporter: replace "rm -rf" with "find -delete"
> "find" is more memory efficient, "rm -rf" may cause OOM with deep dir and many files
### 9.1.3 (9/26/2024 - 10/17/2024)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ public void cleanupArchive(LocalDate date) {
Path eventFilePath = Path.of(logDir.toString(), eventPath(date));
shell.execute("rm", "-f", eventFilePath.toString());

Path traceLogDirPath = Path.of(logDir.toString(), Strings.format("/trace/{}", date));
shell.execute("rm", "-rf", traceLogDirPath.toString());
String traceLogDirPath = Path.of(logDir.toString(), Strings.format("/trace/{}", date)).toString();
shell.execute("find", traceLogDirPath, "-type", "f", "-delete");
shell.execute("find", traceLogDirPath, "-type", "d", "-delete");
}

public String actionLogPath(LocalDate date) {
Expand Down

0 comments on commit c3467fc

Please sign in to comment.