mod_pep: Limit possible growth of node subscription info 0.11
authorKim Alvefur <zash@zash.se>
Thu, 04 Nov 2021 00:36:41 +0100
branch0.11
changeset 12091 19f67d44ec37
parent 12090 1dc00ca6ee9d
child 12092 e5028f6eb599
mod_pep: Limit possible growth of node subscription info
plugins/mod_pep.lua
--- a/plugins/mod_pep.lua	Thu Nov 04 00:35:44 2021 +0100
+++ b/plugins/mod_pep.lua	Thu Nov 04 00:36:41 2021 +0100
@@ -33,11 +33,14 @@
 	end
 end):table();
 
+-- size of caches with smaller objects
+local info_cache_size = module:get_option_number("pep_info_cache_size", 10000);
+
 -- username -> recipient -> set of nodes
-local recipients = {};
+local recipients = cache.new(info_cache_size):table();
 
 -- caps hash -> set of nodes
-local hash_map = {};
+local hash_map = cache.new(info_cache_size):table();
 
 local host = module.host;