Software /
code /
prosody
Comparison
util/pubsub.lua @ 12153:26af75c20163
util.pubsub: Fix item store resize to "max"
Previously this would end up passing the "max" directly to the
underlying storage.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 06 Jan 2022 01:18:35 +0100 |
parent | 11854:b605cbd5f13b |
child | 12975:d10957394a3c |
comparison
equal
deleted
inserted
replaced
12152:0939675955f1 | 12153:26af75c20163 |
---|---|
3 local errors = require "util.error"; | 3 local errors = require "util.error"; |
4 | 4 |
5 local service_mt = {}; | 5 local service_mt = {}; |
6 | 6 |
7 local default_config = { | 7 local default_config = { |
8 max_items = 256; | |
8 itemstore = function (config, _) return cache.new(config["max_items"]) end; | 9 itemstore = function (config, _) return cache.new(config["max_items"]) end; |
9 broadcaster = function () end; | 10 broadcaster = function () end; |
10 subscriber_filter = function (subs) return subs end; | 11 subscriber_filter = function (subs) return subs end; |
11 itemcheck = function () return true; end; | 12 itemcheck = function () return true; end; |
12 get_affiliation = function () end; | 13 get_affiliation = function () end; |
839 end | 840 end |
840 self.data[node] = nil; | 841 self.data[node] = nil; |
841 end | 842 end |
842 elseif old_config["max_items"] ~= node_obj.config["max_items"] then | 843 elseif old_config["max_items"] ~= node_obj.config["max_items"] then |
843 if self.data[node] then | 844 if self.data[node] then |
844 self.data[node]:resize(self.nodes[node].config["max_items"]); | 845 local max_items = self.nodes[node].config["max_items"]; |
846 if max_items == "max" then | |
847 max_items = self.config.max_items; | |
848 end | |
849 self.data[node]:resize(max_items); | |
845 end | 850 end |
846 end | 851 end |
847 | 852 |
848 return true; | 853 return true; |
849 end | 854 end |