]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Some stats logic update for the new schema
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 6 Apr 2018 08:58:03 +0000 (09:58 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 6 Apr 2018 08:58:03 +0000 (09:58 +0100)
src/libstat/backends/redis_backend.c

index 121162fc8e18b4ab023195b6f0fc0cf8a1e354cf..68da6bc89947b573485e1e08ced5fe0e8c692d0f 100644 (file)
@@ -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;
                                        }
                                }
                        }