From: Vsevolod Stakhov Date: Mon, 5 Jun 2017 14:31:32 +0000 (+0100) Subject: [Minor] Do not overlap expiry and store_tokens X-Git-Tag: 1.6.0~60 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=01da9a41f78436aa2e80f38e9836dc68aacf8c57;p=rspamd.git [Minor] Do not overlap expiry and store_tokens --- diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index ef6448a00..2012671f8 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -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; }