aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorresec <resec0109@gmail.com>2019-11-19 11:30:21 +0000
committerresec <resec0109@gmail.com>2019-11-19 11:30:21 +0000
commit811f3d7c675d12860231d269bc728047f9ba80ff (patch)
tree60205759864bbbfc20289d114064647e22e4ed7e
parentd98f4ef54a9fa3d8f4cf5e224f8427063b264444 (diff)
downloadrspamd-811f3d7c675d12860231d269bc728047f9ba80ff.tar.gz
rspamd-811f3d7c675d12860231d269bc728047f9ba80ff.zip
eliminate smembers: fix again
-rw-r--r--src/libstat/backends/redis_backend.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index eab238532..d4ac6a30e 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -846,9 +846,10 @@ rspamd_redis_stat_keys (redisAsyncContext *c, gpointer r, gpointer priv)
{
struct rspamd_redis_stat_elt *redis_elt = (struct rspamd_redis_stat_elt *)priv;
struct rspamd_redis_stat_cbdata *cbdata;
- redisReply *reply = r, *more, *elts, *elt;
+ redisReply *reply = r, *more_elt, *elts, *elt;
gchar **pk, *k;
guint i, processed = 0;
+ gboolean more = false;
cbdata = redis_elt->cbdata;
@@ -860,9 +861,13 @@ rspamd_redis_stat_keys (redisAsyncContext *c, gpointer r, gpointer priv)
if (c->err == 0 && r != NULL) {
if (reply->type == REDIS_REPLY_ARRAY) {
- more = reply->element[0];
+ more_elt = reply->element[0];
elts = reply->element[1];
+ if (more_elt != NULL && more_elt->str != NULL && strcmp (more_elt->str, "0") != 0) {
+ more = true;
+ }
+
g_ptr_array_set_size (cbdata->cur_keys, elts->elements);
for (i = 0; i < elts->elements; i ++) {
@@ -915,7 +920,7 @@ rspamd_redis_stat_keys (redisAsyncContext *c, gpointer r, gpointer priv)
}
}
- if (more != NULL && more->integer) {
+ if (more) {
/* Cleanup the cbdata->cur_keys and re-allowcate */
for (i = 0; i < cbdata->cur_keys->len; i ++) {
k = g_ptr_array_index (cbdata->cur_keys, i);
@@ -928,8 +933,10 @@ rspamd_redis_stat_keys (redisAsyncContext *c, gpointer r, gpointer priv)
/* Get more keys */
redisAsyncCommand (cbdata->redis, rspamd_redis_stat_keys, redis_elt,
- "SSCAN %s_keys %d COUNT 1000",
- cbdata->elt->ctx->stcf->symbol, more->integer);
+ "SSCAN %s_keys %s COUNT 1000",
+ cbdata->elt->ctx->stcf->symbol, more_elt->str);
+
+ cbdata->inflight += 1;
}
else {
/* Set up the required keys */