aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-01-06 01:18:35 +0100
committerKim Alvefur <zash@zash.se>2022-01-06 01:18:35 +0100
commit8a97d634a4c5c5d046424c227a4b26bb9f486481 (patch)
treead017e0fe1b3a44a99fb60a0713c8a3443bef91b /util/pubsub.lua
parentb5b67241e043e9d5e11a5a21f00b9afe7e795282 (diff)
downloadprosody-8a97d634a4c5c5d046424c227a4b26bb9f486481.tar.gz
prosody-8a97d634a4c5c5d046424c227a4b26bb9f486481.zip
util.pubsub: Fix item store resize to "max"
Previously this would end up passing the "max" directly to the underlying storage.
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 75620a42..acb34db9 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -5,6 +5,7 @@ local errors = require "util.error";
local service_mt = {};
local default_config = {
+ max_items = 256;
itemstore = function (config, _) return cache.new(config["max_items"]) end;
broadcaster = function () end;
subscriber_filter = function (subs) return subs end;
@@ -841,7 +842,11 @@ function service:set_node_config(node, actor, new_config) --> ok, err
end
elseif old_config["max_items"] ~= node_obj.config["max_items"] then
if self.data[node] then
- self.data[node]:resize(self.nodes[node].config["max_items"]);
+ local max_items = self.nodes[node].config["max_items"];
+ if max_items == "max" then
+ max_items = self.config.max_items;
+ end
+ self.data[node]:resize(max_items);
end
end