1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-04-21 17:15:43 +02:00

Disable sync chunk writes to avoid lag during backups

This commit is contained in:
chylex 2024-04-11 05:29:12 +02:00
parent 21c90cb7c2
commit 3b313bf0a8
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
3 changed files with 4 additions and 2 deletions
Agent
Phantom.Agent.Minecraft/Properties
Phantom.Agent.Services/Backups

View File

@ -18,4 +18,5 @@ static class MinecraftServerProperties {
public static readonly MinecraftServerProperty<ushort> ServerPort = new UnsignedShort("server-port");
public static readonly MinecraftServerProperty<ushort> RconPort = new UnsignedShort("rcon.port");
public static readonly MinecraftServerProperty<bool> EnableRcon = new Boolean("enable-rcon");
public static readonly MinecraftServerProperty<bool> SyncChunkWrites = new Boolean("sync-chunk-writes");
}

View File

@ -5,11 +5,13 @@ namespace Phantom.Agent.Minecraft.Properties;
public sealed record ServerProperties(
ushort ServerPort,
ushort RconPort,
bool EnableRcon = true
bool EnableRcon = true,
bool SyncChunkWrites = false
) {
internal void SetTo(JavaPropertiesFileEditor properties) {
MinecraftServerProperties.ServerPort.Set(properties, ServerPort);
MinecraftServerProperties.RconPort.Set(properties, RconPort);
MinecraftServerProperties.EnableRcon.Set(properties, EnableRcon);
MinecraftServerProperties.SyncChunkWrites.Set(properties, SyncChunkWrites);
}
}

View File

@ -55,7 +55,6 @@ sealed partial class BackupServerCommandDispatcher : IDisposable {
}
public async Task SaveAllChunks() {
// TODO Try if not flushing and waiting a few seconds before flushing reduces lag.
await process.SendCommand(MinecraftCommand.SaveAll(flush: true), cancellationToken);
await savedTheGame.Task.WaitAsync(TimeSpan.FromMinutes(1), cancellationToken);
}