# HG changeset patch # User Kim Alvefur # Date 1480955738 -3600 # Node ID 3733bdbe0b22003bffeac67dabd498d41c10b7e7 # Parent 1f55edac1f720e3411db755f36a0412b259704d9 mod_blocklist: Check first level cache before calling blocklist getter diff -r 1f55edac1f72 -r 3733bdbe0b22 plugins/mod_blocklist.lua --- a/plugins/mod_blocklist.lua Thu Dec 08 18:06:18 2016 +0100 +++ b/plugins/mod_blocklist.lua Mon Dec 05 17:35:38 2016 +0100 @@ -77,10 +77,7 @@ end local function get_blocklist(username) - local blocklist = cache[username]; - if not blocklist then - blocklist = cache2:get(username); - end + local blocklist = cache2:get(username); if not blocklist then if not user_exists(username, module.host) then return null_blocklist; @@ -102,7 +99,7 @@ local origin, stanza = event.origin, event.stanza; local username = origin.username; local reply = st.reply(stanza):tag("blocklist", { xmlns = "urn:xmpp:blocking" }); - local blocklist = get_blocklist(username); + local blocklist = cache[username] or get_blocklist(username); for jid in pairs(blocklist) do if jid then reply:tag("item", { jid = jid }):up(); @@ -156,7 +153,7 @@ return true; end - local blocklist = get_blocklist(username); + local blocklist = cache[username] or get_blocklist(username); local new_blocklist = { -- We set the [false] key to someting as a signal not to migrate privacy lists