Diff

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
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Tue Jul 10 00:22:05 2018 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Tue Jul 10 00:51:55 2018 +0200
@@ -596,9 +596,10 @@
 local function archive_itemstore(archive, config, user, node)
 	module:log("debug", "Creation of itemstore for node %s with config %s", node, config);
 	local get_set = {};
+	local max_items = config["max_items"];
 	function get_set:items() -- luacheck: ignore 212/self
 		local data, err = archive:find(user, {
-			limit = tonumber(config["max_items"]);
+			limit = tonumber(max_items);
 			reverse = true;
 		});
 		if not data then