Software /
code /
prosody
Comparison
plugins/mod_pubsub/pubsub.lib.lua @ 9005:7203a1b65d1b
mod_pubsub: Cache only max_items to avoid holding reference to possibly outdated config
Only max_items is used anyways
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 10 Jul 2018 00:51:55 +0200 |
parent | 8981:b6cb0a8f75b1 |
child | 9006:935e5ca43792 |
comparison
equal
deleted
inserted
replaced
9004:50a0f405e6c9 | 9005:7203a1b65d1b |
---|---|
594 end | 594 end |
595 | 595 |
596 local function archive_itemstore(archive, config, user, node) | 596 local function archive_itemstore(archive, config, user, node) |
597 module:log("debug", "Creation of itemstore for node %s with config %s", node, config); | 597 module:log("debug", "Creation of itemstore for node %s with config %s", node, config); |
598 local get_set = {}; | 598 local get_set = {}; |
599 local max_items = config["max_items"]; | |
599 function get_set:items() -- luacheck: ignore 212/self | 600 function get_set:items() -- luacheck: ignore 212/self |
600 local data, err = archive:find(user, { | 601 local data, err = archive:find(user, { |
601 limit = tonumber(config["max_items"]); | 602 limit = tonumber(max_items); |
602 reverse = true; | 603 reverse = true; |
603 }); | 604 }); |
604 if not data then | 605 if not data then |
605 module:log("error", "Unable to get items: %s", err); | 606 module:log("error", "Unable to get items: %s", err); |
606 return true; | 607 return true; |