]> source.dussan.org Git - rspamd.git/commitdiff
Fix redis stats
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jan 2016 13:55:32 +0000 (13:55 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 Jan 2016 13:55:32 +0000 (13:55 +0000)
src/libstat/backends/redis_backend.c
src/lua/lua_redis.c

index 8bcc2c0f96229ebd316629f9cebfd5fd6d3fd802..808959d73d404cc77ab27a79405c3b2e6f1e0eba 100644 (file)
@@ -571,28 +571,28 @@ rspamd_redis_stat_keys (redisAsyncContext *c, gpointer r, gpointer priv)
                                                cbdata->inflight += 2;
                                        }
                                }
-
-                               /* Set up the required keys */
-                               ucl_object_insert_key (cbdata->cur,
-                                               ucl_object_typed_new (UCL_INT), "revision", 0, false);
-                               ucl_object_insert_key (cbdata->cur,
-                                               ucl_object_typed_new (UCL_INT), "used", 0, false);
-                               ucl_object_insert_key (cbdata->cur,
-                                               ucl_object_typed_new (UCL_INT), "total", 0, false);
-                               ucl_object_insert_key (cbdata->cur,
-                                               ucl_object_typed_new (UCL_INT), "size", 0, false);
-                               ucl_object_insert_key (cbdata->cur,
-                                               ucl_object_fromstring (cbdata->elt->ctx->stcf->symbol),
-                                               "symbol", 0, false);
-                               ucl_object_insert_key (cbdata->cur, ucl_object_fromstring ("redis"),
-                                               "type", 0, false);
-                               ucl_object_insert_key (cbdata->cur, ucl_object_fromint (0),
-                                               "languages", 0, false);
-                               ucl_object_insert_key (cbdata->cur, ucl_object_fromint (processed),
-                                               "users", 0, false);
                        }
                }
 
+               /* Set up the required keys */
+               ucl_object_insert_key (cbdata->cur,
+                               ucl_object_typed_new (UCL_INT), "revision", 0, false);
+               ucl_object_insert_key (cbdata->cur,
+                               ucl_object_typed_new (UCL_INT), "used", 0, false);
+               ucl_object_insert_key (cbdata->cur,
+                               ucl_object_typed_new (UCL_INT), "total", 0, false);
+               ucl_object_insert_key (cbdata->cur,
+                               ucl_object_typed_new (UCL_INT), "size", 0, false);
+               ucl_object_insert_key (cbdata->cur,
+                               ucl_object_fromstring (cbdata->elt->ctx->stcf->symbol),
+                               "symbol", 0, false);
+               ucl_object_insert_key (cbdata->cur, ucl_object_fromstring ("redis"),
+                               "type", 0, false);
+               ucl_object_insert_key (cbdata->cur, ucl_object_fromint (0),
+                               "languages", 0, false);
+               ucl_object_insert_key (cbdata->cur, ucl_object_fromint (processed),
+                               "users", 0, false);
+
                rspamd_upstream_ok (cbdata->selected);
        }
        else {
index c74cdb7edb14aaf414cfbd9921b49d46bdc626ab..14b6662c3943439c9ef129d3b74801df84a16264 100644 (file)
@@ -316,10 +316,8 @@ static void
 lua_redis_timeout (int fd, short what, gpointer u)
 {
        struct lua_redis_ctx *ctx = u;
-       struct lua_redis_userdata *ud;
 
        REF_RETAIN (ctx);
-       ud = &ctx->d.async;
        msg_info ("timeout while querying redis server");
        lua_redis_push_error ("timeout while connecting the server", ctx, TRUE);
        REF_RELEASE (ctx);
@@ -711,7 +709,6 @@ lua_redis_connect (lua_State *L)
        struct lua_redis_userdata *ud;
        struct rspamd_task *task = NULL;
        gboolean ret = FALSE;
-       gdouble timeout = REDIS_DEFAULT_TIMEOUT;
 
        if (lua_istable (L, 1)) {
                /* Table version */
@@ -750,13 +747,6 @@ lua_redis_connect (lua_State *L)
 
                lua_pop (L, 1);
 
-               lua_pushstring (L, "timeout");
-               if (lua_type (L, -1) == LUA_TNUMBER) {
-                       lua_gettable (L, -2);
-               }
-               timeout = lua_tonumber (L, -1);
-               lua_pop (L, 1);
-
                if (task != NULL && addr != NULL) {
                        ctx = g_slice_alloc0 (sizeof (struct lua_redis_ctx));
                        REF_INIT_RETAIN (ctx, lua_redis_dtor);