Skip to content

Commit

Permalink
Fixed backup in progress being removed by incomplete backup cleanup task
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon3055 committed Oct 24, 2024
1 parent c5641e9 commit 5be45d5
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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++;
Expand Down

0 comments on commit 5be45d5

Please sign in to comment.