aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-19 15:18:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-19 15:18:38 +0100
commit25dbf162bc04aa98d64193ef03bb3cdd06981f3c (patch)
treeaabec0f53350b2097ed7348b7e4a52f05414f14b /src
parentac8bf6185abbc1f1fd9a4a9b6a2b9258cb7ac596 (diff)
downloadrspamd-25dbf162bc04aa98d64193ef03bb3cdd06981f3c.tar.gz
rspamd-25dbf162bc04aa98d64193ef03bb3cdd06981f3c.zip
[Minor] Fix crash
Issue: #2354
Diffstat (limited to 'src')
-rw-r--r--src/libstat/backends/redis_backend.c8
1 files 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";
}