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;
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 */
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,
#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
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;
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);
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) {
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) {
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) {