]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Stop expiry if read_servers configured 2182/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Tue, 17 Apr 2018 16:34:37 +0000 (19:34 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Tue, 17 Apr 2018 16:34:37 +0000 (19:34 +0300)
lualib/lua_redis.lua
src/plugins/lua/bayes_expiry.lua

index 067353abcb05b0c25b385f4024175c217ba5d22c..1be476fbe06f1e018822b8af06a5cc1cf23be645 100644 (file)
@@ -69,7 +69,7 @@ local function try_load_redis_servers(options, rspamd_config, result)
         upstreams_write = upstream_list.create(options['write_servers'],
           default_port)
       end
-    else
+    elseif not options['read_servers'] then
       upstreams_write = upstreams_read
     end
   end
@@ -106,10 +106,11 @@ local function try_load_redis_servers(options, rspamd_config, result)
     result['password'] = options['password']
   end
 
-  if upstreams_write and upstreams_read then
+  if upstreams_read then
     result.read_servers = upstreams_read
-    result.write_servers = upstreams_write
-
+    if upstreams_write then
+      result.write_servers = upstreams_write
+    end
     return true
   end
 
index 77ec2e52708c12b2a7e996abffd6e794918d0449..488219367cb51a0f852be732de566679f3b72ea0 100644 (file)
@@ -81,6 +81,7 @@ local function check_redis_classifier(cls, cfg)
         end
       end
     end
+    if redis_params['read_servers'] ~= redis_params['write_servers'] then return end
 
     table.insert(settings.classifiers, {
       symbol_spam = symbol_spam,