mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Replace custom/UnitXP timers with ClassicAPI C_Timer
- ScheduleTimer now wraps C_Timer.After, removing the dedicated timer frame + per-frame OnUpdate loop + timers queue. - Aura-tracking cleanup -> C_Timer.NewTicker(5) (_auraCleanupTicker); drop the UnitXP arm, the named global CleveRoids_AuraTrackingCleanupTimer, and the inline "not hasUnitXP" fallback in OnAuraCastOther. - Libdebuff cleanup -> C_Timer.NewTicker(30) (_cleanupTicker); drop the UnitXP arm and CleveRoids_LibDebuffCleanupTimer. - Shutdown cancels the tickers instead of UnitXP timer disarm. Cleanup now always runs (was gated on hasUnitXP) and no longer depends on UnitXP threaded timers or named global callbacks. Tickers self-guard on isShuttingDown and are cancelled on shutdown.
This commit is contained in:
+7
-14
@@ -4218,21 +4218,14 @@ delayedTrackingFrame:SetScript("OnUpdate", function()
|
||||
end
|
||||
end)
|
||||
|
||||
-- UnitXP threaded timer for periodic cleanup (runs in separate thread, fires only when due)
|
||||
-- Replaces piggyback on 20Hz OnUpdate — avoids function call overhead every 50ms
|
||||
if CleveRoids.hasUnitXP then
|
||||
-- Global callback (UnitXP timers require global function name as string)
|
||||
function CleveRoids_LibDebuffCleanupTimer()
|
||||
if CleveRoids.isShuttingDown then return end
|
||||
local libRef = CleveRoids.libdebuff
|
||||
if libRef and libRef.CleanupStaleTrackingData then
|
||||
libRef:CleanupStaleTrackingData()
|
||||
end
|
||||
-- Periodic libdebuff cleanup via ClassicAPI's C_Timer (every 30s).
|
||||
CleveRoids._cleanupTicker = C_Timer.NewTicker(30, function()
|
||||
if CleveRoids.isShuttingDown then return end
|
||||
local libRef = CleveRoids.libdebuff
|
||||
if libRef and libRef.CleanupStaleTrackingData then
|
||||
libRef:CleanupStaleTrackingData()
|
||||
end
|
||||
|
||||
-- Arm timer: 30s initial delay, 30s repeat interval
|
||||
CleveRoids._cleanupTimerId = UnitXP("timer", "arm", 30000, 30000, "CleveRoids_LibDebuffCleanupTimer")
|
||||
end
|
||||
end)
|
||||
|
||||
local ev = CreateFrame("Frame", "CleveRoidsLibDebuffFrame", UIParent)
|
||||
ev:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
|
||||
Reference in New Issue
Block a user