From cba42ac760e613b4663311ab3dbe6601f0a16d24 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 13 Jun 2024 08:50:10 -0700 Subject: Fix storage sorting --- src/main/java/org/traccar/helper/Log.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/traccar') diff --git a/src/main/java/org/traccar/helper/Log.java b/src/main/java/org/traccar/helper/Log.java index 37df6a537..6c6d49550 100644 --- a/src/main/java/org/traccar/helper/Log.java +++ b/src/main/java/org/traccar/helper/Log.java @@ -283,8 +283,8 @@ public final class Log { var stores = new ArrayList>(); for (FileStore store : FileSystems.getDefault().getFileStores()) { try { - long totalSpace = store.getTotalSpace(); long usableSpace = store.getUsableSpace(); + long totalSpace = store.getTotalSpace(); if (totalSpace > 1_000_000_000) { stores.add(new Pair<>(usableSpace, totalSpace)); } @@ -292,7 +292,7 @@ public final class Log { } } return stores.stream() - .sorted(Comparator.comparingDouble(o -> 1 - o.getFirst() / (double) o.getSecond())) + .sorted(Comparator.comparingDouble(p -> p.getFirst() / (double) p.getSecond())) .flatMap(p -> Stream.of(p.getFirst(), p.getSecond())) .mapToLong(Long::longValue) .toArray(); -- cgit v1.2.3