mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-09 16:31:59 +00:00
optimization: async dedicated server autosaving (#1473)
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "../../Minecraft.World/TilePos.h"
|
||||
#include "../../Minecraft.World/compression.h"
|
||||
#include "../../Minecraft.World/OldChunkStorage.h"
|
||||
#include "../../Minecraft.World/ConsoleSaveFileOriginal.h"
|
||||
#include "../../Minecraft.World/net.minecraft.world.level.tile.h"
|
||||
#include "../../Minecraft.World/Random.h"
|
||||
|
||||
@@ -325,6 +326,7 @@ static void TickCoreSystems()
|
||||
g_NetworkManager.DoWork();
|
||||
ProfileManager.Tick();
|
||||
StorageManager.Tick();
|
||||
ConsoleSaveFileOriginal::flushPendingBackgroundSave();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -701,9 +703,20 @@ int main(int argc, char **argv)
|
||||
{
|
||||
C4JThread waitThread(&WaitForServerStoppedThreadProc, NULL, "WaitServerStopped");
|
||||
waitThread.Run();
|
||||
while (waitThread.isRunning())
|
||||
{
|
||||
TickCoreSystems();
|
||||
Sleep(10);
|
||||
}
|
||||
waitThread.WaitForCompletion(INFINITE);
|
||||
}
|
||||
|
||||
while (ConsoleSaveFileOriginal::hasPendingBackgroundSave())
|
||||
{
|
||||
TickCoreSystems();
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
LogInfof("shutdown", "Cleaning up and exiting.");
|
||||
WinsockNetLayer::Shutdown();
|
||||
LogDebugf("shutdown", "Network layer shutdown complete.");
|
||||
|
||||
Reference in New Issue
Block a user