From 023ba544e2e953cda439ea4e4e3d2cbaa3daae86 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 26 Jan 2016 13:55:32 +0000 Subject: [PATCH] Fix redis stats --- src/libstat/backends/redis_backend.c | 38 ++++++++++++++-------------- src/lua/lua_redis.c | 10 -------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 8bcc2c0f9..808959d73 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -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 { diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index c74cdb7ed..14b6662c3 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -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); -- 2.39.5