Commit 555adf72 authored by antirez's avatar antirez
Browse files

TCC: run threaded commands synchronously if called by Lua/MULTI.

parent cee2ba9b
......@@ -4378,7 +4378,7 @@ RedisModuleBlockedClient *moduleBlockClient(RedisModuleCtx *ctx, RedisModuleCmdF
bc->unblocked = 0;
c->bpop.timeout = timeout;
if (islua || ismulti) {
if (ctx->module != coremodule && (islua || ismulti)) {
c->bpop.module_blocked_handle = NULL;
addReplyError(c, islua ?
"Blocking module command called from Lua script" :
......@@ -7303,8 +7303,11 @@ void executeThreadedCommand(client *c, coreThreadedCommandCallback callback, voi
sdslen(c->argv[j]->ptr));
/* Try to spawn the thread that will actually execute the command. */
int islua = c->flags & CLIENT_LUA;
int ismulti = c->flags & CLIENT_MULTI;
pthread_t tid;
if (CoreModuleBlockedClients >= CoreModuleThreadsMax ||
if (islua || ismulti ||
CoreModuleBlockedClients >= CoreModuleThreadsMax ||
pthread_create(&tid,NULL,threadedCoreCommandEnty,tcpd) != 0)
{
RM_AbortBlock(bc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment