Merge pull request #5113 from 0xtonyxia/using-compare-func-instead

Streams: using streamCompareID() instead of direct compare.
This commit is contained in:
Salvatore Sanfilippo
2018-07-16 18:34:35 +02:00
committed by GitHub
3 changed files with 4 additions and 10 deletions

View File

@ -1401,9 +1401,7 @@ void xreadCommand(client *c) {
* 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))
{
if (streamCompareID(&s->last_id, last) > 0) {
serve_synchronously = 1;
*gt = *last;
}
@ -1411,9 +1409,7 @@ void xreadCommand(client *c) {
} else {
/* For consumers without a group, we serve synchronously if we can
* actually provide at least one item from the stream. */
if (s->last_id.ms > gt->ms ||
(s->last_id.ms == gt->ms && s->last_id.seq > gt->seq))
{
if (streamCompareID(&s->last_id, gt) > 0) {
serve_synchronously = 1;
}
}