]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Do not overlap expiry and store_tokens
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 5 Jun 2017 14:31:32 +0000 (15:31 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 5 Jun 2017 14:31:32 +0000 (15:31 +0100)
src/libstat/backends/redis_backend.c

index ef6448a00e32303738d0af8973057b7296d55d26..2012671f8fa40f4f57355cc282a103d406a038c7 100644 (file)
@@ -465,7 +465,8 @@ rspamd_redis_tokens_to_query (struct rspamd_task *task,
                                                                "%s\r\n",
                                                cmd_len, command,
                                                prefix_len, prefix,
-                                               l0, n0, l1, n1);
+                                               l0, n0,
+                                               l1, n1);
                        }
 
                        ret = redisAsyncFormattedCommand (rt->redis, NULL, NULL,
@@ -478,26 +479,6 @@ rspamd_redis_tokens_to_query (struct rspamd_task *task,
                                return NULL;
                        }
 
-                       if (rt->ctx->new_schema && rt->ctx->expiry > 0) {
-                               out->len = 0;
-                               l1 = rspamd_snprintf (n1, sizeof (n1), "%d",
-                                               rt->ctx->expiry);
-
-                               rspamd_printf_fstring (&out, ""
-                                                               "*3\r\n"
-                                                               "$6\r\n"
-                                                               "EXPIRE\r\n"
-                                                               "$%d\r\n"
-                                                               "%s\r\n"
-                                                               "$%d\r\n"
-                                                               "%s\r\n",
-                                               l0, n0,
-                                               l1, n1);
-                               redisAsyncFormattedCommand (rt->redis, NULL, NULL,
-                                               out->str, out->len);
-                               out->len = 0;
-                       }
-
                        if (rt->ctx->store_tokens) {
 
                                if (!rt->ctx->new_schema) {
@@ -550,6 +531,24 @@ rspamd_redis_tokens_to_query (struct rspamd_task *task,
                                                n0, (size_t)l0);
                        }
 
+                       if (rt->ctx->new_schema && rt->ctx->expiry > 0) {
+                               out->len = 0;
+                               l1 = rspamd_snprintf (n1, sizeof (n1), "%d",
+                                               rt->ctx->expiry);
+
+                               rspamd_printf_fstring (&out, ""
+                                                               "*3\r\n"
+                                                               "$6\r\n"
+                                                               "EXPIRE\r\n"
+                                                               "$%d\r\n"
+                                                               "%s\r\n"
+                                                               "$%d\r\n"
+                                                               "%s\r\n",
+                                               l0, n0,
+                                               l1, n1);
+                               redisAsyncFormattedCommand (rt->redis, NULL, NULL,
+                                               out->str, out->len);
+                       }
 
                        out->len = 0;
                }