moved save call to the synchronous part. Still have to figure out how to deal with #81.....

This commit is contained in:
szymon 2023-09-10 00:39:52 +02:00
parent 354c83f314
commit 1eb407338d
2 changed files with 16 additions and 13 deletions

View File

@ -1,18 +1,18 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
minecraft_version=1.20 minecraft_version=1.20.1
yarn_mappings=1.20+build.1 yarn_mappings=1.20.1+build.10
loader_version=0.14.21 loader_version=0.14.22
#Fabric api #Fabric api
fabric_version=0.83.0+1.20 fabric_version=0.88.1+1.20.1
#Cloth Config #Cloth Config
cloth_version=11.0.98 cloth_version=11.1.106
#ModMenu #ModMenu
modmenu_version=7.0.0-beta.2 modmenu_version=7.2.2
databreaker_version=0.2.10 databreaker_version=0.2.10
@ -20,6 +20,6 @@ databreaker_version=0.2.10
pgzip_commit_hash=af5f5c297e735f3f2df7aa4eb0e19a5810b8aff6 pgzip_commit_hash=af5f5c297e735f3f2df7aa4eb0e19a5810b8aff6
# Mod Properties # Mod Properties
mod_version = 3.1.0 mod_version = 3.1.1
maven_group = net.szum123321 maven_group = net.szum123321
archives_base_name = textile_backup archives_base_name = textile_backup

View File

@ -64,11 +64,6 @@ public record ExecutableBackup(@NotNull MinecraftServer server,
} }
@Override @Override
public Void call() throws Exception { public Void call() throws Exception {
if (save) { //save the world
log.sendInfoAL(this, "Saving server...");
server.saveAll(true, true, false);
}
Path outFile = Utilities.getBackupRootPath(Utilities.getLevelName(server)).resolve(getFileName()); Path outFile = Utilities.getBackupRootPath(Utilities.getLevelName(server)).resolve(getFileName());
log.trace("Outfile is: {}", outFile); log.trace("Outfile is: {}", outFile);
@ -76,8 +71,8 @@ public record ExecutableBackup(@NotNull MinecraftServer server,
try { try {
//I think I should synchronise these two next calls... //I think I should synchronise these two next calls...
Utilities.disableWorldSaving(server); Utilities.disableWorldSaving(server);
Globals.INSTANCE.disableWatchdog = true;
Globals.INSTANCE.disableWatchdog = true;
Globals.INSTANCE.updateTMPFSFlag(server); Globals.INSTANCE.updateTMPFSFlag(server);
log.sendInfoAL(this, "Starting backup"); log.sendInfoAL(this, "Starting backup");
@ -225,6 +220,14 @@ public record ExecutableBackup(@NotNull MinecraftServer server,
ExecutableBackup v = new ExecutableBackup(server, commandSource, initiator, save, cleanup, comment, LocalDateTime.now()); ExecutableBackup v = new ExecutableBackup(server, commandSource, initiator, save, cleanup, comment, LocalDateTime.now());
if(announce) v.announce(); if(announce) v.announce();
if (save) { //save the world
// We need to flush everything as next thing we'll be copying all the files.
// this is mostly the reason for #81 - minecraft doesn't flush during scheduled saves.
log.sendInfoAL(this.commandSource, "Saving server...");
server.saveAll(true, true, false);
}
return v; return v;
} }
} }