Release v0.6.35: reduce resident memory and compact shared dictionaries

This commit is contained in:
2026-11-04 14:08:05 +02:00
parent 004fee4976
commit d13e9849a7
21 changed files with 469 additions and 100 deletions
+14 -11
View File
@@ -46,7 +46,7 @@ std::wstring App::syncCommand(int action, const std::vector<SyncChoice> &choices
syncDone.store(true);
});
}
catch (...) { syncRunning = false; throw; }
catch (...) { syncRunning = false; Bytes().swap(syncSnapshot); syncResult = {}; throw; }
return syncStatus;
}
void App::pollSync()
@@ -57,25 +57,28 @@ void App::pollSync()
{
if (busy) return;
syncWorker.join();
// Own completed payloads locally so every return/exception releases them.
auto result = std::exchange(syncResult, SyncResult{});
auto snapshot = std::exchange(syncSnapshot, Bytes{});
syncRunning = false;
syncDone = false;
syncStatus = syncResult.status;
if (syncResult.success)
syncStatus = result.status;
if (result.success)
{
if (loadSyncConfig(data) != syncConnection || encodeSettings(settings) != syncSnapshot)
if (loadSyncConfig(data) != syncConnection || encodeSettings(settings) != snapshot)
{
syncStatus = L"Local settings or connection changed during sync. Checking again shortly.";
nextSync = GetTickCount64() + 2000;
return;
}
auto next = restoreSyncSettings(syncResult.settings, settings, layouts, syncConnection.keepLocalLayouts);
if (encodeSettings(next) != syncSnapshot)
auto next = restoreSyncSettings(result.settings, settings, layouts, syncConnection.keepLocalLayouts);
if (encodeSettings(next) != snapshot)
{
atomicWrite(data / L"settings-before-sync.bin", protect(syncSnapshot));
atomicWrite(data / L"settings-before-sync.bin", protect(snapshot));
applySettings(next);
}
saveSyncBase(data, syncConnection, syncResult.base.empty() ? syncResult.settings : syncResult.base);
pendingSyncConflicts = syncResult.conflicts;
saveSyncBase(data, syncConnection, result.base.empty() ? result.settings : result.base);
pendingSyncConflicts = std::move(result.conflicts);
conflictConnection = syncConnection;
SYSTEMTIME time{}; GetLocalTime(&time);
wchar_t stamp[32]{};
@@ -84,8 +87,8 @@ void App::pollSync()
}
// Back off after errors (including bad credentials) instead of repeatedly
// hitting userpass lockout. The explicit Sync button remains available.
syncRetryAfter = syncResult.success ? 0 : GetTickCount64() + 15 * 60000;
nextSync = syncResult.success ? GetTickCount64() + SyncIntervalMs : syncRetryAfter;
syncRetryAfter = result.success ? 0 : GetTickCount64() + 15 * 60000;
nextSync = result.success ? GetTickCount64() + SyncIntervalMs : syncRetryAfter;
}
if (!syncRunning && GetTickCount64() >= nextSync)
{