mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix(xinfo): send integer info in correct type (#1379)
Signed-off-by: Abhradeep Chakraborty <abhradeep@dragonflydb.io>
This commit is contained in:
parent
1011720a25
commit
c72aa6f5f2
2 changed files with 10 additions and 6 deletions
|
@ -158,7 +158,7 @@ TEST_F(RdbTest, Stream) {
|
|||
|
||||
resp = Run({"xinfo", "groups", "key:1"}); // test dereferences array of size 1
|
||||
EXPECT_THAT(resp, ArrLen(8));
|
||||
EXPECT_THAT(resp.GetVec(), ElementsAre("name", "g2", "consumers", "0", "pending", "0",
|
||||
EXPECT_THAT(resp.GetVec(), ElementsAre("name", "g2", "consumers", IntArg(0), "pending", IntArg(0),
|
||||
"last-delivered-id", "1655444851523-1"));
|
||||
|
||||
resp = Run({"xinfo", "groups", "key:2"});
|
||||
|
|
|
@ -1266,13 +1266,17 @@ void StreamFamily::XInfo(CmdArgList args, ConnectionContext* cntx) {
|
|||
if (result) {
|
||||
(*cntx)->StartArray(result->size());
|
||||
for (const auto& ginfo : *result) {
|
||||
absl::AlphaNum an1(ginfo.consumer_size);
|
||||
absl::AlphaNum an2(ginfo.pending_size);
|
||||
string last_id = StreamIdRepr(ginfo.last_id);
|
||||
string_view arr[8] = {"name", ginfo.name, "consumers", an1.Piece(),
|
||||
"pending", an2.Piece(), "last-delivered-id", last_id};
|
||||
|
||||
(*cntx)->SendStringArr(absl::Span<string_view>{arr, 8}, RedisReplyBuilder::MAP);
|
||||
(*cntx)->StartCollection(4, RedisReplyBuilder::MAP);
|
||||
(*cntx)->SendBulkString("name");
|
||||
(*cntx)->SendBulkString(ginfo.name);
|
||||
(*cntx)->SendBulkString("consumers");
|
||||
(*cntx)->SendLong(ginfo.consumer_size);
|
||||
(*cntx)->SendBulkString("pending");
|
||||
(*cntx)->SendLong(ginfo.pending_size);
|
||||
(*cntx)->SendBulkString("last-delivered-id");
|
||||
(*cntx)->SendBulkString(last_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue