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
a8c1bb31
Commit
a8c1bb31
authored
Jul 10, 2018
by
antirez
Browse files
Streams: fix new XREADGROUP sync logic.
parent
1a02b5f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_stream.c
View file @
a8c1bb31
...
@@ -1385,11 +1385,21 @@ void xreadCommand(client *c) {
...
@@ -1385,11 +1385,21 @@ void xreadCommand(client *c) {
gt
->
seq
!=
UINT64_MAX
)
gt
->
seq
!=
UINT64_MAX
)
{
{
serve_synchronously
=
1
;
serve_synchronously
=
1
;
}
else
{
/* We also want to serve a consumer in a consumer group
* synchronously in case the group top item delivered is smaller
* than what the stream has inside. */
streamID
*
last
=
&
groups
[
i
]
->
last_id
;
if
(
s
->
last_id
.
ms
>
last
->
ms
||
(
s
->
last_id
.
ms
==
last
->
ms
&&
s
->
last_id
.
seq
>
last
->
seq
))
{
serve_synchronously
=
1
;
*
gt
=
*
last
;
}
}
}
}
else
{
}
else
{
/* For clients without a consumer group specified, we serve the
/* For consumers without a group, we serve synchronously if we can
* client synchronously only if we can actually provide at least
* actually provide at least one item from the stream. */
* one item from the stream. */
if
(
s
->
last_id
.
ms
>
gt
->
ms
||
if
(
s
->
last_id
.
ms
>
gt
->
ms
||
(
s
->
last_id
.
ms
==
gt
->
ms
&&
s
->
last_id
.
seq
>
gt
->
seq
))
(
s
->
last_id
.
ms
==
gt
->
ms
&&
s
->
last_id
.
seq
>
gt
->
seq
))
{
{
...
...
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