those didnt work
This commit is contained in:
parent
febbb95b97
commit
7734c16e06
@ -102,14 +102,13 @@ public class MakeBackupRunnable implements Callable<Void> {
|
||||
case TAR -> new AbstractTarArchiver().createArchive(world, outFile, context, coreCount);
|
||||
}
|
||||
|
||||
Globals.INSTANCE.getQueueExecutor().submit(new Cleanup(context.commandSource(), Utilities.getLevelName(context.server())));
|
||||
if(!Globals.INSTANCE.getQueueExecutor().isShutdown())
|
||||
Globals.INSTANCE.getQueueExecutor().submit(new Cleanup(context.commandSource(), Utilities.getLevelName(context.server())));
|
||||
|
||||
if (config.get().broadcastBackupDone) {
|
||||
Utilities.notifyPlayers(context.server(), "Done!");
|
||||
} else {
|
||||
log.sendInfoAL(context, "Done!");
|
||||
}
|
||||
} catch (InterruptedException | ExecutionException | IOException e) {
|
||||
if (config.get().broadcastBackupDone) Utilities.notifyPlayers(context.server(), "Done!");
|
||||
else log.sendInfoAL(context, "Done!");
|
||||
|
||||
} catch (Throwable e) {
|
||||
//ExecutorService swallows exception, so I need to catch everything
|
||||
log.error("An exception occurred when trying to create new backup file!", e);
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
package net.szum123321.textile_backup.core.digest;
|
||||
|
||||
import net.szum123321.textile_backup.Globals;
|
||||
import net.szum123321.textile_backup.core.CompressionStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -29,11 +30,13 @@ public class FileTreeHashBuilder {
|
||||
private long hash = 0, filesProcessed = 0, filesTotalSize = 0;
|
||||
|
||||
public void update(Path path, long newHash) throws IOException {
|
||||
if(path.getFileName().toString().equals(CompressionStatus.DATA_FILENAME)) return;
|
||||
|
||||
var hasher = Globals.CHECKSUM_SUPPLIER.get();
|
||||
|
||||
long size = Files.size(path);
|
||||
|
||||
hasher.update(path.toString().getBytes(StandardCharsets.UTF_8));
|
||||
hasher.update(path.getFileName().toString().getBytes(StandardCharsets.UTF_8));
|
||||
hasher.update(newHash);
|
||||
|
||||
synchronized (lock) {
|
||||
|
@ -19,8 +19,6 @@
|
||||
package net.szum123321.textile_backup.core.digest;
|
||||
|
||||
import net.szum123321.textile_backup.Globals;
|
||||
import net.szum123321.textile_backup.core.FileTreeHashBuilder;
|
||||
import net.szum123321.textile_backup.core.Hash;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.FilterOutputStream;
|
||||
@ -41,14 +39,14 @@ public class HashingOutputStream extends FilterOutputStream {
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
super.write(b);
|
||||
hasher.update(b);
|
||||
super.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte @NotNull [] b, int off, int len) throws IOException {
|
||||
super.write(b, off, len);
|
||||
hasher.update(b, off, len);
|
||||
super.write(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user