Software / code / prosody
Comparison
plugins/mod_pep.lua @ 12087:19f67d44ec37 0.11
mod_pep: Limit possible growth of node subscription info
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 04 Nov 2021 00:36:41 +0100 |
| parent | 12086:1dc00ca6ee9d |
| child | 12088:e5028f6eb599 |
comparison
equal
deleted
inserted
replaced
| 12086:1dc00ca6ee9d | 12087:19f67d44ec37 |
|---|---|
| 31 if item then | 31 if item then |
| 32 module:remove_item("pep-service", item); | 32 module:remove_item("pep-service", item); |
| 33 end | 33 end |
| 34 end):table(); | 34 end):table(); |
| 35 | 35 |
| 36 -- size of caches with smaller objects | |
| 37 local info_cache_size = module:get_option_number("pep_info_cache_size", 10000); | |
| 38 | |
| 36 -- username -> recipient -> set of nodes | 39 -- username -> recipient -> set of nodes |
| 37 local recipients = {}; | 40 local recipients = cache.new(info_cache_size):table(); |
| 38 | 41 |
| 39 -- caps hash -> set of nodes | 42 -- caps hash -> set of nodes |
| 40 local hash_map = {}; | 43 local hash_map = cache.new(info_cache_size):table(); |
| 41 | 44 |
| 42 local host = module.host; | 45 local host = module.host; |
| 43 | 46 |
| 44 local node_config = module:open_store("pep", "map"); | 47 local node_config = module:open_store("pep", "map"); |
| 45 local known_nodes = module:open_store("pep"); | 48 local known_nodes = module:open_store("pep"); |