1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix: aggregate xread and xrange replys (#1383)

This commit is contained in:
Andy Dunstall 2023-06-10 13:34:12 +01:00 committed by GitHub
parent e837b3d229
commit 302623c645
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1460,6 +1460,8 @@ void XReadBlock(ReadOpts opts, ConnectionContext* cntx) {
cntx->transaction->Execute(std::move(range_cb), true);
if (result) {
SinkReplyBuilder::ReplyAggregator agg(cntx->reply_builder());
(*cntx)->StartArray(1);
(*cntx)->StartArray(2);
@ -1567,6 +1569,8 @@ void StreamFamily::XRead(CmdArgList args, ConnectionContext* cntx) {
}
}
SinkReplyBuilder::ReplyAggregator agg(cntx->reply_builder());
(*cntx)->StartArray(resolved_streams);
for (size_t i = 0; i != res.size(); i++) {
// Ignore empty streams.
@ -1677,6 +1681,8 @@ void StreamFamily::XRangeGeneric(CmdArgList args, bool is_rev, ConnectionContext
OpResult<RecordVec> result = cntx->transaction->ScheduleSingleHopT(std::move(cb));
if (result) {
SinkReplyBuilder::ReplyAggregator agg(cntx->reply_builder());
(*cntx)->StartArray(result->size());
for (const auto& item : *result) {
(*cntx)->StartArray(2);