aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_redis.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-09-01 23:32:53 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-09-01 23:32:53 +0100
commitc7bde491422159dc532c7d6c9934f350ba803c40 (patch)
tree3293b847ac0270d4dcd64c5314943ca05c045c0d /src/lua/lua_redis.c
parent02db3e291d9b1301faa052af992ee923e2d266e3 (diff)
downloadrspamd-c7bde491422159dc532c7d6c9934f350ba803c40.tar.gz
rspamd-c7bde491422159dc532c7d6c9934f350ba803c40.zip
[Minor] Remove redundant code
Diffstat (limited to 'src/lua/lua_redis.c')
-rw-r--r--src/lua/lua_redis.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 71463d350..3d5ac3db9 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -1590,24 +1590,17 @@ lua_redis_exec (lua_State *L)
return 0;
}
else {
- if (false /* !ctx->d.sync */) {
- lua_pushstring (L, "cannot exec commands when not connected");
+ if (ctx->cmds_pending == 0 && g_queue_get_length (ctx->replies) == 0) {
+ lua_pushstring (L, "No pending commands to execute");
lua_error (L);
- return 0;
+ }
+ if (ctx->cmds_pending == 0 && g_queue_get_length (ctx->replies) > 0) {
+ gint results = lua_redis_push_results (ctx, L);
+ return results;
}
else {
- if (ctx->cmds_pending == 0 && g_queue_get_length (ctx->replies) == 0) {
- lua_pushstring (L, "No pending commands to execute");
- lua_error (L);
- }
- if (ctx->cmds_pending == 0 && g_queue_get_length (ctx->replies) > 0) {
- gint results = lua_redis_push_results (ctx, L);
- return results;
- }
- else {
- ctx->thread = lua_thread_pool_get_running_entry (ctx->async.cfg->lua_thread_pool);
- return lua_thread_yield (ctx->thread, 0);
- }
+ ctx->thread = lua_thread_pool_get_running_entry (ctx->async.cfg->lua_thread_pool);
+ return lua_thread_yield (ctx->thread, 0);
}
}
}