CG: Fix order of calls in streamReplyWithRange().

We need to check if we are going to serve the request via the PEL before
inserting a deferred array len in the client output buffer.
This commit is contained in:
antirez 2018-01-24 16:47:39 +01:00
parent 41809fd969
commit bbec4569a5

View File

@ -694,7 +694,7 @@ size_t streamReplyWithRangeFromConsumerPEL(client *c, stream *s, streamID *start
* 'noack' is non-zero. * 'noack' is non-zero.
*/ */
size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end, size_t count, int rev, streamCG *group, streamConsumer *consumer, int noack) { size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end, size_t count, int rev, streamCG *group, streamConsumer *consumer, int noack) {
void *arraylen_ptr = addDeferredMultiBulkLength(c); void *arraylen_ptr;
size_t arraylen = 0; size_t arraylen = 0;
streamIterator si; streamIterator si;
int64_t numfields; int64_t numfields;
@ -713,6 +713,7 @@ size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end
group,consumer); group,consumer);
} }
arraylen_ptr = addDeferredMultiBulkLength(c);
streamIteratorStart(&si,s,start,end,rev); streamIteratorStart(&si,s,start,end,rev);
while(streamIteratorGetID(&si,&id,&numfields)) { while(streamIteratorGetID(&si,&id,&numfields)) {
/* Update the group last_id if needed. */ /* Update the group last_id if needed. */