aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/learn_cache/redis_cache.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-12 16:27:25 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-12 16:27:25 +0000
commitad06636cc54ee400e2ca90b685296c153a3add7a (patch)
tree5d046383b73657011099daaaa719f5e9f3766676 /src/libstat/learn_cache/redis_cache.c
parent20c9bfdc2db1066ac174b462c5e9e48287b63ee7 (diff)
downloadrspamd-ad06636cc54ee400e2ca90b685296c153a3add7a.tar.gz
rspamd-ad06636cc54ee400e2ca90b685296c153a3add7a.zip
Don't fail stats when pre-results are set
Diffstat (limited to 'src/libstat/learn_cache/redis_cache.c')
-rw-r--r--src/libstat/learn_cache/redis_cache.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c
index ec2203463..47bfd89a6 100644
--- a/src/libstat/learn_cache/redis_cache.c
+++ b/src/libstat/learn_cache/redis_cache.c
@@ -270,6 +270,10 @@ rspamd_stat_cache_redis_runtime (struct rspamd_task *task,
return NULL;
}
+ if (task->tokens == NULL || task->tokens->len == 0) {
+ return NULL;
+ }
+
if (learn) {
up = rspamd_upstream_get (ctx->write_servers,
RSPAMD_UPSTREAM_MASTER_SLAVE,
@@ -322,7 +326,10 @@ rspamd_stat_cache_redis_check (struct rspamd_task *task,
gchar *h;
h = rspamd_mempool_get_variable (task->task_pool, "words_hash");
- g_assert (h != NULL);
+
+ if (h == NULL) {
+ return RSPAMD_LEARN_INGORE;
+ }
double_to_tv (rt->ctx->timeout, &tv);