diff options
author | antirez <antirez@gmail.com> | 2020-06-03 17:00:52 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2020-06-10 10:40:18 +0200 |
commit | 555adf7290dba9516a9c2b8b4fabcaa10b85f498 (patch) | |
tree | 72b226e099a3a0d2e089ae9baf4949debd69c07c | |
parent | cee2ba9b67982e3a451ad75562ad451509d14916 (diff) | |
download | redis-555adf7290dba9516a9c2b8b4fabcaa10b85f498.tar.gz |
TCC: run threaded commands synchronously if called by Lua/MULTI.
-rw-r--r-- | src/module.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/module.c b/src/module.c index 547d2591d..b313094e3 100644 --- a/src/module.c +++ b/src/module.c @@ -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); |