Mercurial > prosody-hg
comparison plugins/mod_blocklist.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 |
| parents | 74b9e05af71e |
| children | a74251a790ed |
comparison
equal
deleted
inserted
replaced
| 13212:3e6e98cc63e9 | 13213:50324f66ca2a |
|---|---|
| 33 -- | 33 -- |
| 34 -- The size of this affects how often we will need to load a blocklist from | 34 -- The size of this affects how often we will need to load a blocklist from |
| 35 -- disk, which we want to avoid during routing. On the other hand, we don't | 35 -- disk, which we want to avoid during routing. On the other hand, we don't |
| 36 -- want to use too much memory either, so this can be tuned by advanced | 36 -- want to use too much memory either, so this can be tuned by advanced |
| 37 -- users. TODO use science to figure out a better default, 64 is just a guess. | 37 -- users. TODO use science to figure out a better default, 64 is just a guess. |
| 38 local cache_size = module:get_option_number("blocklist_cache_size", 64); | 38 local cache_size = module:get_option_integer("blocklist_cache_size", 64, 1); |
| 39 local cache2 = require"prosody.util.cache".new(cache_size); | 39 local cache2 = require"prosody.util.cache".new(cache_size); |
| 40 | 40 |
| 41 local null_blocklist = {}; | 41 local null_blocklist = {}; |
| 42 | 42 |
| 43 module:add_feature("urn:xmpp:blocking"); | 43 module:add_feature("urn:xmpp:blocking"); |
