Skip to content
Snippets Groups Projects
Commit 9c1acf80 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

squash! Archive bridge pool assignments again.

Replace a large number representing three days by code that actually
subtracts 3 days from a timestamp.
parent 7a642ea1
Branches
Tags
No related merge requests found
......@@ -26,8 +26,10 @@ import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -336,8 +338,7 @@ public class BridgePoolAssignmentsProcessor extends CollecTorMain {
* the last three days.
*/
public void cleanUpRsyncDirectory() {
long cutOffMillis = System.currentTimeMillis()
- 3L * 24L * 60L * 60L * 1000L;
Instant cutOff = Instant.now().minus(3L, ChronoUnit.DAYS);
Stack<File> allFiles = new Stack<>();
allFiles.add(new File(this.recentPathName));
while (!allFiles.isEmpty()) {
......@@ -347,7 +348,7 @@ public class BridgePoolAssignmentsProcessor extends CollecTorMain {
if (null != filesInDirectory) {
allFiles.addAll(Arrays.asList(filesInDirectory));
}
} else if (file.lastModified() < cutOffMillis) {
} else if (Instant.ofEpochMilli(file.lastModified()).isBefore(cutOff)) {
try {
Files.deleteIfExists(file.toPath());
} catch (IOException e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment