mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 00:50:50 +00:00
Streams: fix new XREADGROUP sync logic.
This commit is contained in:
parent
1a02b5f6ee
commit
a8c1bb310e
@ -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))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user