Skip to content

Commit

Permalink
add debug logging to AnsibleRunnerCleanUpService
Browse files Browse the repository at this point in the history
  • Loading branch information
dangel101 committed Dec 19, 2022
1 parent e7af087 commit 4231457
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void scheduleJob() {
}

private void checkExecutionTimeStamp() {
log.debug("Started AnsibleRunnerCleanUp Service");
int artifactsLifeTime = Config.<Integer> getValue(ConfigValues.AnsibleRunnerArtifactsLifetimeInDays);
Stream.of(new File(AnsibleConstants.ANSIBLE_RUNNER_PATH.toString()).listFiles()).forEach(file -> {
long creationInDays;
Expand All @@ -60,6 +61,7 @@ private void checkExecutionTimeStamp() {
}
long todayInDays = FileTime.fromMillis(new Date().getTime()).to(TimeUnit.DAYS);
if (todayInDays - creationInDays > artifactsLifeTime) {
log.debug("Deleting directory {}", file.getAbsolutePath());
try {
Files.walk(Paths.get(file.getAbsolutePath()))
.sorted(Comparator.reverseOrder())
Expand All @@ -71,5 +73,6 @@ private void checkExecutionTimeStamp() {
}
}
});
log.debug("Finished AnsibleRunnerCleanUp Service");
}
}

0 comments on commit 4231457

Please sign in to comment.