Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
555adf72
Commit
555adf72
authored
Jun 03, 2020
by
antirez
Browse files
TCC: run threaded commands synchronously if called by Lua/MULTI.
parent
cee2ba9b
Changes
1
Show whitespace changes
Inline
Side-by-side
src/module.c
View file @
555adf72
...
@@ -4378,7 +4378,7 @@ RedisModuleBlockedClient *moduleBlockClient(RedisModuleCtx *ctx, RedisModuleCmdF
...
@@ -4378,7 +4378,7 @@ RedisModuleBlockedClient *moduleBlockClient(RedisModuleCtx *ctx, RedisModuleCmdF
bc
->
unblocked
=
0
;
bc
->
unblocked
=
0
;
c
->
bpop
.
timeout
=
timeout
;
c
->
bpop
.
timeout
=
timeout
;
if
(
islua
||
ismulti
)
{
if
(
ctx
->
module
!=
coremodule
&&
(
islua
||
ismulti
)
)
{
c
->
bpop
.
module_blocked_handle
=
NULL
;
c
->
bpop
.
module_blocked_handle
=
NULL
;
addReplyError
(
c
,
islua
?
addReplyError
(
c
,
islua
?
"Blocking module command called from Lua script"
:
"Blocking module command called from Lua script"
:
...
@@ -7303,8 +7303,11 @@ void executeThreadedCommand(client *c, coreThreadedCommandCallback callback, voi
...
@@ -7303,8 +7303,11 @@ void executeThreadedCommand(client *c, coreThreadedCommandCallback callback, voi
sdslen
(
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. */
int
islua
=
c
->
flags
&
CLIENT_LUA
;
int
ismulti
=
c
->
flags
&
CLIENT_MULTI
;
pthread_t
tid
;
pthread_t
tid
;
if
(
CoreModuleBlockedClients
>=
CoreModuleThreadsMax
||
if
(
islua
||
ismulti
||
CoreModuleBlockedClients
>=
CoreModuleThreadsMax
||
pthread_create
(
&
tid
,
NULL
,
threadedCoreCommandEnty
,
tcpd
)
!=
0
)
pthread_create
(
&
tid
,
NULL
,
threadedCoreCommandEnty
,
tcpd
)
!=
0
)
{
{
RM_AbortBlock
(
bc
);
RM_AbortBlock
(
bc
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment