Thread Tools Display Modes
07/05/14, 04:12 AM   #1
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Odd delay/UI thread lockup while selling junk

I recently started getting delays when using the "sell junk" option of vendors. Usually a half second stall when selling as little as 4 items.

My theory that there is some addon that is doing work (like scanning the whole inventory) everytime a item is removed. And that this event is fired once for each item sold as junk.

I just have too many addons that could be the cause
My first guess is Inventory Insight. So I disabeled it for now and see if it continues (I had not enabeled it until recently).
Any other addons that register the respective sell/item loss event to look at? Maybe one of the research helpers (that also keeps track of what you have in your inventory)?
  Reply With Quote
07/05/14, 04:19 AM   #2
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
As far as I can tell the issue is more pronounced with Invetory Insight Running. But it is not the sole cause.

I also figured how to cheaply test it:
Just break a stack of anything with 0 worth into multiple 1 unit stacks. Mark those as junk. Finished.

It might be a dual issue:
Too many addons subscribing the event.
Each of them doing the work in the event itself.

It is best to only set a bool "data out of date" and then do the scan next UI update or some regular interval like that. That way multiple events would not cause multipel scans.
  Reply With Quote
07/05/14, 10:41 AM   #3
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
This should not be an issue with Research Assistant, because I have a bit of event buffering to prevent such spamminess.
  Reply With Quote
07/05/14, 11:14 AM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Might be another interesting excercise Imagine an addon that hooks EVENT_MANAGER:RegisterForEvent (right away, not in it's OnLoaded handler), and reports how much time various handlers take.
Lua Code:
  1. local EM = GetEventManager()
  2. local originalRegisterForEvent = EM.RegisterForEvent
  3. local function RegisterForEventHook(self, tag, event, handler)
  4.     if event ~= EVENT_INVENTORY_SINGLE_SLOT_UPDATE then
  5.         -- for events we're not interested in, just call the original
  6.         return originalRegisterForEvent(self, tag, event, handler)
  7.     end
  8.     local function wrapped_handler(evt, ...)
  9.         local t1 = GetGameTimeMilliseconds()
  10.         handler(evt, ...)
  11.         local t2 = GetGameTimeMilliseconds()
  12.         d(("'%s' spent %.0fms handling event %s"):format(tag, t2 - t1, evt))
  13.     end
  14.     return originalRegisterForEvent(self, tag, event, wrapped_handler)
  15. end
  16. getmetatable(EM).__index.RegisterForEvent = RegisterForEventHook

edit: fixed missing ')' and tested, it works

Last edited by merlight : 07/08/14 at 09:47 AM.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » Odd delay/UI thread lockup while selling junk


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off