diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-05 15:31:32 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-06-05 15:31:32 +0100 |
commit | 01da9a41f78436aa2e80f38e9836dc68aacf8c57 (patch) | |
tree | 83bd742f65bfca6bac65678de29f82f15c8d29bf /src/libstat | |
parent | ce57de5ff68c0425ddbbb5f792f36aca21d582a3 (diff) | |
download | rspamd-01da9a41f78436aa2e80f38e9836dc68aacf8c57.tar.gz rspamd-01da9a41f78436aa2e80f38e9836dc68aacf8c57.zip |
[Minor] Do not overlap expiry and store_tokens
Diffstat (limited to 'src/libstat')
-rw-r--r-- | src/libstat/backends/redis_backend.c | 41 |
1 files changed, 20 insertions, 21 deletions
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; } |