@@ -6,6 +6,8 @@ one_shot = false; | |||
cache_file = "$DBDIR/symbols.cache"; | |||
# How often maps are checked ( | |||
map_watch_interval = 5min; | |||
# Multiplier for watch interval for files | |||
map_file_watch_multiplier = 0.1; | |||
dynamic_conf = "$DBDIR/rspamd_dynamic"; | |||
history_file = "$DBDIR/rspamd.history"; | |||
check_all_filters = false; |
@@ -377,6 +377,7 @@ struct rspamd_config { | |||
GList *maps; /**< maps active */ | |||
gdouble map_timeout; /**< maps watch timeout */ | |||
gdouble map_file_watch_multiplier; /**< multiplier for watch timeout when maps are files */ | |||
struct symbols_cache *cache; /**< symbols cache object */ | |||
gchar *cache_filename; /**< filename of cache file */ |
@@ -1983,6 +1983,12 @@ rspamd_rcl_config_init (struct rspamd_config *cfg) | |||
G_STRUCT_OFFSET (struct rspamd_config, map_timeout), | |||
RSPAMD_CL_FLAG_TIME_FLOAT, | |||
"Interval for checking maps"); | |||
rspamd_rcl_add_default_handler (sub, | |||
"map_file_watch_multiplier", | |||
rspamd_rcl_parse_struct_double, | |||
G_STRUCT_OFFSET (struct rspamd_config, map_file_watch_multiplier), | |||
0, | |||
"Multiplier for map watch interval when map is file"); | |||
rspamd_rcl_add_default_handler (sub, | |||
"dynamic_conf", | |||
rspamd_rcl_parse_struct_string, |
@@ -36,6 +36,7 @@ | |||
#define DEFAULT_RLIMIT_NOFILE 2048 | |||
#define DEFAULT_RLIMIT_MAXCORE 0 | |||
#define DEFAULT_MAP_TIMEOUT 60.0 * 5 | |||
#define DEFAULT_MAP_FILE_WATCH_MULTIPLIER 1 | |||
#define DEFAULT_MIN_WORD 4 | |||
#define DEFAULT_MAX_WORD 40 | |||
#define DEFAULT_WORDS_DECAY 200 | |||
@@ -137,6 +138,7 @@ rspamd_config_new (void) | |||
rspamd_str_equal); | |||
cfg->map_timeout = DEFAULT_MAP_TIMEOUT; | |||
cfg->map_file_watch_multiplier = DEFAULT_MAP_FILE_WATCH_MULTIPLIER; | |||
cfg->log_level = G_LOG_LEVEL_WARNING; | |||
cfg->log_extended = TRUE; |
@@ -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) { |