Comparison

plugins/mod_pep.lua @ 11722:bc2d3f110a39

mod_pep: Remove use of RLU cache when persist_items was set to false This behavior came from some confusion over the meaning of persist_items. The correct behavior is that items are only stored when it is set to true. When set to false, the service becomes a "pure" publish-subscribe service, where items are forgotten immediately after broadcasting.
author Kim Alvefur <zash@zash.se>
date Wed, 21 Jul 2021 23:02:25 +0200
parent 11631:6641ca266d94
child 11724:86e68c0a4f05
comparison
equal deleted inserted replaced
11721:7a77f0c05382 11722:bc2d3f110a39
108 108
109 local function simple_itemstore(username) 109 local function simple_itemstore(username)
110 local driver = storagemanager.get_driver(module.host, "pep_data"); 110 local driver = storagemanager.get_driver(module.host, "pep_data");
111 return function (config, node) 111 return function (config, node)
112 local max_items = tonumber_max_items(config["max_items"]); 112 local max_items = tonumber_max_items(config["max_items"]);
113 if config["persist_items"] then 113 module:log("debug", "Creating new persistent item store for user %s, node %q", username, node);
114 module:log("debug", "Creating new persistent item store for user %s, node %q", username, node); 114 local archive = driver:open("pep_"..node, "archive");
115 local archive = driver:open("pep_"..node, "archive"); 115 return lib_pubsub.archive_itemstore(archive, max_items, username, node, false);
116 return lib_pubsub.archive_itemstore(archive, max_items, username, node, false);
117 else
118 module:log("debug", "Creating new ephemeral item store for user %s, node %q", username, node);
119 return cache.new(max_items);
120 end
121 end 116 end
122 end 117 end
123 118
124 local function get_broadcaster(username) 119 local function get_broadcaster(username)
125 local user_bare = jid_join(username, host); 120 local user_bare = jid_join(username, host);