Skip to content

Commit

Permalink
Merge pull request redis#5129 from soloestoy/xinfo-show-last-id
Browse files Browse the repository at this point in the history
Streams: show last id for streams and groups
  • Loading branch information
antirez committed Jul 16, 2018
2 parents a3e3b81 + 3c2425d commit ff84677
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/t_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -2279,18 +2279,20 @@ NULL
raxSeek(&ri,"^",NULL,0);
while(raxNext(&ri)) {
streamCG *cg = ri.data;
addReplyMultiBulkLen(c,6);
addReplyMultiBulkLen(c,8);
addReplyStatus(c,"name");
addReplyBulkCBuffer(c,ri.key,ri.key_len);
addReplyStatus(c,"consumers");
addReplyLongLong(c,raxSize(cg->consumers));
addReplyStatus(c,"pending");
addReplyLongLong(c,raxSize(cg->pel));
addReplyStatus(c,"last-delivered-id");
addReplyStreamID(c,&cg->last_id);
}
raxStop(&ri);
} else if (!strcasecmp(opt,"STREAM") && c->argc == 3) {
/* XINFO STREAM <key> (or the alias XINFO <key>). */
addReplyMultiBulkLen(c,12);
addReplyMultiBulkLen(c,14);
addReplyStatus(c,"length");
addReplyLongLong(c,s->length);
addReplyStatus(c,"radix-tree-keys");
Expand All @@ -2299,6 +2301,8 @@ NULL
addReplyLongLong(c,s->rax->numnodes);
addReplyStatus(c,"groups");
addReplyLongLong(c,s->cgroups ? raxSize(s->cgroups) : 0);
addReplyStatus(c,"last-id");
addReplyStreamID(c,&s->last_id);

/* To emit the first/last entry we us the streamReplyWithRange()
* API. */
Expand Down

0 comments on commit ff84677

Please sign in to comment.