changeset 40:dc3a66688e50

More debug message tweaks. Put comm and loot caches on separate-but-related expirations; comm is now a bit shorter and loot is now a bit longer. Check cache expirations more often (possibly revert this).
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 30 Dec 2011 21:29:44 +0000
parents 8f7ec6ccf5e3
children d6b8858c1b64
files abbreviations.lua core.lua gui.lua
diffstat 3 files changed, 20 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/abbreviations.lua	Thu Dec 29 23:15:51 2011 +0000
+++ b/abbreviations.lua	Fri Dec 30 21:29:44 2011 +0000
@@ -35,6 +35,7 @@
 	["Alysrazor"] = "Steppin' Razor",  -- how many people have read Neuromancer, hmmmm
 	["Majordomo Staghelm"] = "Mojododo",
 	-- Dragon Soul
+	["Morchok"] = "Porkchop",
 	["Warlord Zon'ozz"] = "Warlord Beach Ball",
 	["Yor'sahj the Unsleeping"] = "Yosimite Sam the Unsleeping",
 	["Hagara the Stormbinder"] = "Hands Across America",
--- a/core.lua	Thu Dec 29 23:15:51 2011 +0000
+++ b/core.lua	Fri Dec 30 21:29:44 2011 +0000
@@ -86,7 +86,7 @@
 	--['heirloom'] = 7,
 }
 local my_name				= UnitName('player')
-local comm_cleanup_ttl		= 5   -- seconds in the cache
+local comm_cleanup_ttl		= 4   -- seconds in the cache
 local revision_large		= nil -- defaults to 1, possibly changed by revision
 local g_LOOT_ITEM_ss, g_LOOT_ITEM_MULTIPLE_sss, g_LOOT_ITEM_SELF_s, g_LOOT_ITEM_SELF_MULTIPLE_ss
 
@@ -305,7 +305,7 @@
 			local fifo = c.fifo
 			local active = #fifo > 0
 			while (#fifo > 0) and (now - fifo[1].t > c.ttl) do
-				addon.dprint('cache', name, "cache removing",fifo[1].t, fifo[1].m)
+				addon.dprint('cache', name, "cache removing", fifo[1].t, "<", fifo[1].m, ">")
 				tremove(fifo,1)
 			end
 			if active and #fifo == 0 and c.func then
@@ -315,10 +315,11 @@
 			alldone = alldone and (#fifo == 0)
 		end
 		if alldone then
-			addon.dprint('cache',"OnLoop finishing animation group")
+			addon.dprint('cache',"OnLoop FINISHING animation group")
 			cleanup_group:Finish()
+		else
+			addon.dprint('cache',"OnLoop done, not yet finished")
 		end
-		addon.dprint('cache',"OnLoop done")
 	end)
 
 	local function _add (cache, x)
@@ -326,16 +327,16 @@
 		cache.hash[x] = datum
 		tinsert (cache.fifo, datum)
 		if not cleanup_group:IsPlaying() then
-			addon.dprint('cache', cache.name, "STARTING animation group")
-			cache.cleanup:SetDuration(2)  -- hmmm
+			addon.dprint('cache', cache.name, "with entry", datum.t, "<", datum.x, "> STARTING animation group")
+			cache.cleanup:SetDuration(1)  -- hmmm
 			cleanup_group:Play()
 		end
 	end
 	local function _test (cache, x)
+		-- FIXME This can return false positives, if called after the onloop
+		-- fifo has been removed but before the GC has removed the weak entry.
+		-- What to do, what to do...
 		return cache.hash[x] ~= nil
-		--[[for _,v in ipairs(cache) do
-			if v.m == x then return true end
-		end]]
 	end
 
 	function create_new_cache (name, ttl, on_alldone)
@@ -721,7 +722,7 @@
 		end
 		table.wipe(candidates)
 	end
-	addon.recent_loot = create_new_cache ('loot', comm_cleanup_ttl, prefer_local_loots)
+	addon.recent_loot = create_new_cache ('loot', comm_cleanup_ttl+3, prefer_local_loots)
 
 	local GetItemInfo, GetItemIcon = GetItemInfo, GetItemIcon
 
@@ -1958,7 +1959,8 @@
 		self.dprint('comm', ":OCR from", sender, "message is", msg)
 
 		if self.recent_messages:test(msg) then
-			return self.dprint('cache', "message <",msg,"> already in cache, skipping")
+			self.dprint('cache', "OCR message <",msg,"> already in cache, skipping")
+			return
 		end
 		self.recent_messages:add(msg)
 
--- a/gui.lua	Thu Dec 29 23:15:51 2011 +0000
+++ b/gui.lua	Fri Dec 30 21:29:44 2011 +0000
@@ -859,7 +859,8 @@
 -- Tab 1:  Events Of Interest (implementation)
 tabs_OnGroupSelected["eoi"] = function(ocontainer,specials)
 	if (not addon.rebroadcast) and (not addon.enabled) and (#g_loot < 1) then
-		return addon.dprint('flow', "Nothing to show in first tab, skipping creation")
+		addon.dprint('flow', "Nothing to show in first tab, skipping creation")
+		return
 	end
 
 	-- The first time this function is called, we set up a persistent ST
@@ -1416,7 +1417,7 @@
 		w:SetDisabled(addon.enabled or addon.rebroadcast)
 		grp:AddChild(w)
 
-		w = mkbutton("EditBox", nil, addon.recent_messages.ttl, [[comm cache (only) ttl]])
+		w = mkbutton("EditBox", nil, addon.recent_messages.ttl, [[comm cache TTL]])
 		w:SetRelativeWidth(0.05)
 		w:SetLabel("ttl")
 		w:SetCallback("OnTextChanged", adv_careful_OnTextChanged)
@@ -1500,9 +1501,10 @@
 			w:SetLabel(d)
 			if d == "notraid" then
 				w:SetDescription[[Tick this before enabling to make the addon work outside of raid groups]]
-			elseif d == "alsolog" then
-				w:SetDescription[[Also log all debug messages to disk. See print_log.lua in the addon folder for later viewing.]]
 			else
+				if d == "alsolog" then
+					w:SetDescription[[Also log all debug messages to disk. See print_log.lua in the addon folder for later viewing.]]
+				end
 				w:SetDisabled(not addon.DEBUG_PRINT)
 			end
 			w:SetValue(v)