From 8a97d634a4c5c5d046424c227a4b26bb9f486481 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 6 Jan 2022 01:18:35 +0100 Subject: util.pubsub: Fix item store resize to "max" Previously this would end up passing the "max" directly to the underlying storage. --- util/pubsub.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'util/pubsub.lua') 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 -- cgit v1.2.3