From 990d21038ee896aab1206e8d7e4de652920883a2 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 16 Feb 2024 11:34:05 -0600 Subject: [PATCH] fix: Fixes initializing cached keys. --- resources/prosody-plugins/mod_rate_limit.lua | 4 ++-- resources/prosody-plugins/token/util.lib.lua | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/prosody-plugins/mod_rate_limit.lua b/resources/prosody-plugins/mod_rate_limit.lua index 7a2cbd22ab..87dcc6b580 100644 --- a/resources/prosody-plugins/mod_rate_limit.lua +++ b/resources/prosody-plugins/mod_rate_limit.lua @@ -125,10 +125,10 @@ local function throttle_session(session) if not session.jitsi_throttle then if (session.conn and session.conn.setlimit) then -- TODO: we don't have a mechanism to unthrottle a session in this case. - module:log("info", "Enabling throttle (%s bytes/s) via setlimit, session=%s, ip=%s.", config.session_rate, session, session.ip); + module:log("info", "Enabling throttle (%s bytes/s) via setlimit, session=%s, ip=%s.", config.session_rate, session.id, session.ip); session.conn:setlimit(config.session_rate); else - module:log("info", "Enabling throttle (%s bytes/s) via filter, session=%s, ip=%s.", config.session_rate, session, session.ip); + module:log("info", "Enabling throttle (%s bytes/s) via filter, session=%s, ip=%s.", config.session_rate, session.id, session.ip); session.jitsi_throttle = new_throttle(config.session_rate, 2); filters.add_filter(session, "bytes/in", limit_bytes_in, 1000); -- throttle.start used for stop throttling after the timeout diff --git a/resources/prosody-plugins/token/util.lib.lua b/resources/prosody-plugins/token/util.lib.lua index 1a776d1042..98605331d1 100644 --- a/resources/prosody-plugins/token/util.lib.lua +++ b/resources/prosody-plugins/token/util.lib.lua @@ -120,6 +120,7 @@ function Util.new(module) end if self.cacheKeysUrl then + self.cachedKeys = {}; local update_keys_cache; update_keys_cache = async.runner(function (name) content, code, cache_for = http_get_with_retry(self.cacheKeysUrl, nr_retries);