]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix crash
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 19 Jul 2018 14:18:38 +0000 (15:18 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 19 Jul 2018 14:18:38 +0000 (15:18 +0100)
Issue: #2354

src/libstat/backends/redis_backend.c

index 9664a61a76ce7219ff264cf6aa1f0bd411511f2b..69c14e1675f0801455227d44e403f24c80fac101 100644 (file)
@@ -1683,9 +1683,6 @@ rspamd_redis_learn_tokens (struct rspamd_task *task, GPtrArray *tokens,
                else {
                        learned_key = "learns_ham";
                }
-
-               redisAsyncCommand (rt->redis, NULL, NULL, "HSET %s version 2",
-                               rt->redis_object_expanded);
        }
 
        addr = rspamd_upstream_addr (up);
@@ -1710,6 +1707,11 @@ rspamd_redis_learn_tokens (struct rspamd_task *task, GPtrArray *tokens,
        redisAsyncCommand (rt->redis, NULL, NULL, "SADD %s_keys %s",
                        rt->stcf->symbol, rt->redis_object_expanded);
 
+       if (rt->ctx->new_schema) {
+               redisAsyncCommand (rt->redis, NULL, NULL, "HSET %s version 2",
+                               rt->redis_object_expanded);
+       }
+
        if (rt->stcf->clcf->flags & RSPAMD_FLAG_CLASSIFIER_INTEGER) {
                redis_cmd = "HINCRBY";
        }