summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-06-04 10:32:01 +0200
committerantirez <antirez@gmail.com>2020-06-10 10:40:18 +0200
commitea3f7c6f48da458e73767fce662128ffd8db1c60 (patch)
tree6a9df64038569000fbd9f8a77324f03eadfa1729
parentca3fd367e849844b3c208933e0c482b29ce39e73 (diff)
downloadredis-ea3f7c6f48da458e73767fce662128ffd8db1c60.tar.gz
TCC: also use synchronous execution on AOF loading.
-rw-r--r--src/module.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/module.c b/src/module.c
index b313094e3..020760955 100644
--- a/src/module.c
+++ b/src/module.c
@@ -7302,11 +7302,15 @@ void executeThreadedCommand(client *c, coreThreadedCommandCallback callback, voi
copy->argv[j] = createStringObject(c->argv[j]->ptr,
sdslen(c->argv[j]->ptr));
- /* Try to spawn the thread that will actually execute the command. */
+ /* Try to spawn the thread that will actually execute the command.
+ * There are many conditions where we perfer to perform a synchronous
+ * execution of the command. For instance in all the situations we
+ * can't block such as Lua script, MULTI/EXEC, or when loading the
+ * AOF file. */
int islua = c->flags & CLIENT_LUA;
int ismulti = c->flags & CLIENT_MULTI;
pthread_t tid;
- if (islua || ismulti ||
+ if (islua || ismulti || server.loading ||
CoreModuleBlockedClients >= CoreModuleThreadsMax ||
pthread_create(&tid,NULL,threadedCoreCommandEnty,tcpd) != 0)
{