Software /
code /
prosody
Diff
plugins/mod_pep.lua @ 13213:50324f66ca2a
plugins: Use integer config API with interval specification where sensible
Many of these fall into a few categories:
- util.cache size, must be >= 1
- byte or item counts that logically can't be negative
- port numbers that should be in 1..0xffff
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 17 Jul 2023 01:38:54 +0200 |
parent | 12977:74b9e05af71e |
line wrap: on
line diff
--- a/plugins/mod_pep.lua Mon Jul 17 00:37:44 2023 +0200 +++ b/plugins/mod_pep.lua Mon Jul 17 01:38:54 2023 +0200 @@ -24,7 +24,7 @@ local pep_service_items = {}; -- size of caches with full pubsub service objects -local service_cache_size = module:get_option_number("pep_service_cache_size", 1000); +local service_cache_size = module:get_option_integer("pep_service_cache_size", 1000, 1); -- username -> util.pubsub service object local services = cache.new(service_cache_size, function (username, _) @@ -36,7 +36,7 @@ end):table(); -- size of caches with smaller objects -local info_cache_size = module:get_option_number("pep_info_cache_size", 10000); +local info_cache_size = module:get_option_integer("pep_info_cache_size", 10000, 1); -- username -> recipient -> set of nodes local recipients = cache.new(info_cache_size):table(); @@ -49,7 +49,7 @@ local node_config = module:open_store("pep", "map"); local known_nodes = module:open_store("pep"); -local max_max_items = module:get_option_number("pep_max_items", 256); +local max_max_items = module:get_option_number("pep_max_items", 256, 0); local function tonumber_max_items(n) if n == "max" then