From 5be45d57dec1768775a2be62637ec312c16ba089 Mon Sep 17 00:00:00 2001 From: brandon3055 Date: Fri, 25 Oct 2024 09:43:52 +1100 Subject: [PATCH] Fixed backup in progress being removed by incomplete backup cleanup task --- .../creeperhost/ftbbackups/BackupHandler.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/net/creeperhost/ftbbackups/BackupHandler.java b/common/src/main/java/net/creeperhost/ftbbackups/BackupHandler.java index 6fa1909..ec3f323 100644 --- a/common/src/main/java/net/creeperhost/ftbbackups/BackupHandler.java +++ b/common/src/main/java/net/creeperhost/ftbbackups/BackupHandler.java @@ -352,14 +352,6 @@ public static void createBackup(MinecraftServer minecraftServer, boolean protect return; } - finishTime.set(System.nanoTime()); - //Workout the time it took to create the backup - long elapsedTime = finishTime.get() - startTime.get(); - //Set backup running state to false - backupRunning.set(false); - //Alert players that backup has finished being created - alertPlayers(minecraftServer, Component.translatable("Backup finished in " + format(elapsedTime) + (Config.cached().display_file_size ? " Size: " + FileUtils.getSizeString(backupLocation.toFile().length()) : ""))); - String sha1; float ratio = 1; long backupSize = FileUtils.getSize(backupLocation.toFile()); @@ -378,6 +370,14 @@ public static void createBackup(MinecraftServer minecraftServer, boolean protect backup.setSize(backupSize); updateJson(); + + finishTime.set(System.nanoTime()); + //Workout the time it took to create the backup + long elapsedTime = finishTime.get() - startTime.get(); + //Set backup running state to false + backupRunning.set(false); + //Alert players that backup has finished being created + alertPlayers(minecraftServer, Component.translatable("Backup finished in " + format(elapsedTime) + (Config.cached().display_file_size ? " Size: " + FileUtils.getSizeString(backupLocation.toFile().length()) : ""))); FTBBackups.LOGGER.info("New backup created at " + backupLocation + " size: " + FileUtils.getSizeString(backupLocation) + " Took: " + format(elapsedTime) + " Sha1: " + sha1); TieredBackupTest.testBackupCount++;