From 63603c9994b7d6dc11b567a2eb3ef6223e3d0fc9 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Tue, 1 Sep 2026 14:28:35 +0200 Subject: [PATCH] Avoid redundant shared cache normalization --- libs/libunitscan.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/libunitscan.lua b/libs/libunitscan.lua index 2ae5446..f92aed6 100644 --- a/libs/libunitscan.lua +++ b/libs/libunitscan.lua @@ -18,6 +18,7 @@ local cachedCacheRoot local cachedRealm local cachedRealmDB local cachedPlayers +local normalizedRealm local function GetPlayerTimestamp(data) if type(data) ~= "table" then return end @@ -215,8 +216,12 @@ local function MigrateLegacyPlayerCaches(playerdb, realmdb, realm) end -- Also clean presentation fields left by earlier revisions of this test - -- branch that already wrote directly into ShaguTweaks_player_cache. - NormalizePlayerTable(playerdb) + -- branch that already wrote directly into ShaguTweaks_player_cache. Do this + -- once per resolved realm, not again during every logout. + if normalizedRealm ~= realm then + NormalizePlayerTable(playerdb) + normalizedRealm = realm + end cacheMigrationDone = true end