summaryrefslogtreecommitdiffstats
path: root/src/libutil/map.c
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-07-07 12:14:28 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-07-07 12:14:28 +0200
commit5bfd0fcf4988799f7e4f029df627687f22e55d83 (patch)
tree5a47095e68fc9018d0163e345178f330bf4021c2 /src/libutil/map.c
parent5c631c922ae329bdca994d0a2967eee80d830cd3 (diff)
downloadrspamd-5bfd0fcf4988799f7e4f029df627687f22e55d83.tar.gz
rspamd-5bfd0fcf4988799f7e4f029df627687f22e55d83.zip
[Feature] Reload file maps more frequently
Diffstat (limited to 'src/libutil/map.c')
-rw-r--r--src/libutil/map.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c
index c0953c90f..4402a7910 100644
--- a/src/libutil/map.c
+++ b/src/libutil/map.c
@@ -1756,7 +1756,12 @@ rspamd_map_add (struct rspamd_config *cfg,
map->backends);
g_ptr_array_add (map->backends, bk);
map->name = rspamd_mempool_strdup (cfg->cfg_pool, map_line);
- map->poll_timeout = cfg->map_timeout;
+
+ if (bk->protocol == MAP_PROTO_FILE) {
+ map->poll_timeout = (cfg->map_timeout * cfg->map_file_watch_multiplier);
+ } else {
+ map->poll_timeout = cfg->map_timeout;
+ }
if (description != NULL) {
map->description = rspamd_mempool_strdup (cfg->cfg_pool, description);
@@ -1820,6 +1825,9 @@ rspamd_map_add_from_ucl (struct rspamd_config *cfg,
bk = rspamd_map_parse_backend (cfg, ucl_object_tostring (cur));
if (bk != NULL) {
+ if (bk->protocol == MAP_PROTO_FILE) {
+ map->poll_timeout = (map->poll_timeout * cfg->map_file_watch_multiplier);
+ }
g_ptr_array_add (map->backends, bk);
if (!map->name) {
@@ -1873,6 +1881,9 @@ rspamd_map_add_from_ucl (struct rspamd_config *cfg,
bk = rspamd_map_parse_backend (cfg, ucl_object_tostring (cur));
if (bk != NULL) {
+ if (bk->protocol == MAP_PROTO_FILE) {
+ map->poll_timeout = (map->poll_timeout * cfg->map_file_watch_multiplier);
+ }
g_ptr_array_add (map->backends, bk);
if (!map->name) {
@@ -1900,6 +1911,9 @@ rspamd_map_add_from_ucl (struct rspamd_config *cfg,
bk = rspamd_map_parse_backend (cfg, ucl_object_tostring (elt));
if (bk != NULL) {
+ if (bk->protocol == MAP_PROTO_FILE) {
+ map->poll_timeout = (map->poll_timeout * cfg->map_file_watch_multiplier);
+ }
g_ptr_array_add (map->backends, bk);
if (!map->name) {