WOW loads guild news for thousands of times upon entering world

Quoted from ngabbs tid 42399961 posted by [老李三鹿李]

Blizzard official UI code in wow-ui-source/Interface/AddOns/Blizzard_Communities/GuildNews.lua

function CommunitiesGuildNewsFrame_OnEvent(self, event)
	if event == "PLAYER_ENTERING_WORLD" then
		QueryGuildNews();
	else
		if ( self:IsShown() ) then
			CommunitiesGuildNews_Update(self);
		end
	end
end

This QueryGuildNews() posts the event GUILD_NEWS_UPDATE for thousands of times every time you enter the world or switch zones, depending on the size of your guild. During this time, your games processes up to 140 million guild news.

It reminds me of the bug in GTA V that loads the user profile json for 1984531500 times when opening the game.

That’s probably why many people get lags since TWW.

How to fix:

You may create a custom addon with such code:

--source: ngabbs.com/read.php?&tid=42399961

local BLZCommunitiesGuildNewsFrame_OnEvent = CommunitiesGuildNewsFrame_OnEvent
local newsRequireUpdate, newsTimer
CommunitiesFrameGuildDetailsFrameNews:SetScript("OnEvent", function(frame, event)
    if event == "GUILD_NEWS_UPDATE" then
        if newsTimer then
            newsRequireUpdate = true
        else
            BLZCommunitiesGuildNewsFrame_OnEvent(frame, event)
            -- Update guild news only for once 1 sec after entering world.
            newsTimer = C_Timer.NewTimer(1, function()
                if newsRequireUpdate then
                    BLZCommunitiesGuildNewsFrame_OnEvent(frame, event)
                end
                newsTimer = nil
            end)
        end
    else
        BLZCommunitiesGuildNewsFrame_OnEvent(frame, event)
    end
end)

… or wait for Blizzard to fix it.

1 Like

The CommunitiesGuildNewsFrame_OnEvent function looks completely fine and isn’t the problem.

The problem is why is the event being triggered so many times? Is it some kind of event being triggered on new frame(graphical frame rate) during some other kind of timer or delay that would normally act as a cutoff to stop it? Is it some async race condition between CPU threads? Lots of other potential reasons.

While the code in the fix will partially mitigate it, the function is still going to continue to be called, granted the branching of the logic will reduce the severity and save it from polling the information.

That was due to how they handled parsing the save file, which if I remember right was essentially doing an extremely inefficient loop where at each step it was recounting all the previous entries in the database. So something like 0, 0+1, 0+1+2, 0+1+2+3, 0+1+2+3+4+… or maybe from the last index counting downward(some kind of pyramid summation or something along those lines basically). It worked fine when the max index was below a certain size, but then they added thousands of items to the game so next thing you know: five extra minutes tacked onto a load screen on a single threaded operation.

Probably members going online and offline, since it seems to only be affecting people in really large guilds.

Yeah but even still, that shouldn’t be triggering 140 million events, even with a full guild, unless there’s some kind of issue like I mentioned about threading tasks and race conditions. Even if you had a 1000 person guild, that would still mean there would be 140k event triggers per guild member. I suppose there could also just be some massive bug in some set of nested loops or something along those lines though. Or it could be some unintentional factorial combination problem.

Either way, we can only speculate since those events are being triggered server-side and that portion of the problem is a black-box for us.

I passed it along to the channels I can. We’ll see where it goes…