fix: async autosave thread safety and commit path

Move StorageManager.AllocateSaveData() back under the save lock (called
on the game thread before releasing). Background thread now only does
pure zlib compression with no StorageManager calls.

Add CommitPendingAsyncSave() to both the game thread tick and
TickCoreSystems() to ensure saves commit during bootstrap, normal
gameplay, and shutdown.
This commit is contained in:
itsRevela
2026-04-01 01:23:50 -05:00
parent 073a511217
commit 68521f8c92
3 changed files with 40 additions and 42 deletions
+5
View File
@@ -2258,6 +2258,11 @@ void MinecraftServer::tick()
PIXBeginNamedEvent(0,"Players tick");
players->tick();
PIXEndNamedEvent();
#if defined(_WINDOWS64)
// Commit any pending async autosave on the game thread (same thread
// that called Flush/AllocateSaveData, which StorageManager requires).
ConsoleSaveFileOriginal::CommitPendingAsyncSave();
#endif
PIXBeginNamedEvent(0,"Connection tick");
connection->tick();
PIXEndNamedEvent();