From: Vsevolod Stakhov Date: Thu, 19 Jul 2018 14:18:38 +0000 (+0100) Subject: [Minor] Fix crash X-Git-Tag: 1.7.9~81 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=25dbf162bc04aa98d64193ef03bb3cdd06981f3c;p=rspamd.git [Minor] Fix crash Issue: #2354 --- 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"; }