From 25dbf162bc04aa98d64193ef03bb3cdd06981f3c Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 19 Jul 2018 15:18:38 +0100 Subject: [PATCH] [Minor] Fix crash Issue: #2354 --- src/libstat/backends/redis_backend.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 9664a61a7..69c14e167 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -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"; } -- 2.39.5