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
4ab662f6
Commit
4ab662f6
authored
Jun 03, 2020
by
antirez
Browse files
TCC: LRANGE: use threaded execution only for listlen > N.
parent
438ffcae
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_list.c
View file @
4ab662f6
...
...
@@ -426,6 +426,7 @@ void lrangeThreadedHalf(client *c, void *options) {
zfree
(
options
);
}
#define LRANGE_THREADED_THRESHOLD 1000
void
lrangeCommand
(
client
*
c
)
{
robj
*
o
;
long
start
,
end
,
llen
,
rangelen
;
...
...
@@ -454,7 +455,9 @@ void lrangeCommand(client *c) {
struct
lrangeThreadOptions
*
opt
=
zmalloc
(
sizeof
(
*
opt
));
opt
->
start
=
start
;
opt
->
rangelen
=
rangelen
;
if
(
lockKey
(
c
,
c
->
argv
[
1
],
LOCKEDKEY_READ
,
&
opt
->
o
)
==
C_ERR
)
{
if
(
llen
<=
LRANGE_THREADED_THRESHOLD
||
lockKey
(
c
,
c
->
argv
[
1
],
LOCKEDKEY_READ
,
&
opt
->
o
)
==
C_ERR
)
{
/* In the case of LRANGE, we execute the command synchronously
* if we are unable to get a lock. */
lrangeThreadedHalf
(
c
,
opt
);
...
...
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