Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions AceComm-3.0/ChatThrottleLib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
-- LICENSE: ChatThrottleLib is released into the Public Domain
--

local CTL_VERSION = 29
local CTL_VERSION = 30

local _G = _G

Expand Down Expand Up @@ -113,10 +113,7 @@ function Ring:Remove(obj)
end
end

-- Note that this is local because there's no upgrade logic for existing ring
-- metatables, and this isn't present on rings created in versions older than
-- v25.
local function Ring_Link(self, other) -- Move and append all contents of another ring to this ring
function Ring:Link(other) -- Move and append all contents of another ring to this ring
if not self.pos then
-- This ring is empty, so just transfer ownership.
self.pos = other.pos
Expand Down Expand Up @@ -201,6 +198,14 @@ function ChatThrottleLib:Init()
end
end

-- All versions need to upgrade existing rings as the metatable isn't
-- shared between library versions.

for _, Prio in pairs(self.Prio) do
setmetatable(Prio.Ring, RingMeta)
setmetatable(Prio.Blocked, RingMeta)
end

-- v4: total send counters per priority
for _, Prio in pairs(self.Prio) do
Prio.nTotalSent = Prio.nTotalSent or 0
Expand Down Expand Up @@ -448,7 +453,7 @@ function ChatThrottleLib.OnUpdate(this,delay)
-- Integrate blocked queues back into their rings periodically.
if self.BlockedQueuesDelay >= 0.35 then
for _, Prio in pairs(self.Prio) do
Ring_Link(Prio.Ring, Prio.Blocked)
Prio.Ring:Link(Prio.Blocked)
end

self.BlockedQueuesDelay = 0
Expand Down