diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-06 09:58:03 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-06 09:58:03 +0100 |
commit | fe180dd5d14574e013e6e5d75502d9da5640863e (patch) | |
tree | 0a616253da18c612227d5622409da313c55f34b3 /src/libstat/backends | |
parent | ed0e23a25095965c478193c8c4770f7d93b4ec6c (diff) | |
download | rspamd-fe180dd5d14574e013e6e5d75502d9da5640863e.tar.gz rspamd-fe180dd5d14574e013e6e5d75502d9da5640863e.zip |
[Minor] Some stats logic update for the new schema
Diffstat (limited to 'src/libstat/backends')
-rw-r--r-- | src/libstat/backends/redis_backend.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 121162fc8..68da6bc89 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -745,7 +745,7 @@ rspamd_redis_stat_learns (redisAsyncContext *c, gpointer r, gpointer priv) rspamd_strtoul (reply->str, reply->len, &num); } - obj = (ucl_object_t *)ucl_object_lookup (cbdata->cur, "revision"); + obj = (ucl_object_t *) ucl_object_lookup (cbdata->cur, "revision"); if (obj) { obj->value.iv += num; } @@ -852,17 +852,26 @@ rspamd_redis_stat_keys (redisAsyncContext *c, gpointer r, gpointer priv) else { learned_key = "learns_ham"; } + redisAsyncCommand (cbdata->redis, + rspamd_redis_stat_learns, + cbdata, + "HGET %s %s", + k, learned_key); + cbdata->inflight += 1; + } + else { + redisAsyncCommand (cbdata->redis, + rspamd_redis_stat_key, + cbdata, + "HLEN %s", + k); + redisAsyncCommand (cbdata->redis, + rspamd_redis_stat_learns, + cbdata, + "HGET %s %s", + k, learned_key); + cbdata->inflight += 2; } - - redisAsyncCommand (cbdata->redis, rspamd_redis_stat_key, - cbdata, - "HLEN %s", - k); - redisAsyncCommand (cbdata->redis, rspamd_redis_stat_learns, - cbdata, - "HGET %s %s", - k, learned_key); - cbdata->inflight += 2; } } } |