Skip to content

Commit 842ab9d

Browse files
committed
Revert "chore: get rid of possible recursion when unwinding structured reply (#5012)"
This reverts commit befb36d.
1 parent 561c0a4 commit 842ab9d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/facade/reply_capture.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,24 @@ void CapturingReplyBuilder::SendDirect(Payload&& val) {
8181
}
8282
}
8383

84-
void CapturingReplyBuilder::Capture(Payload val, bool collapse_if_needed) {
84+
void CapturingReplyBuilder::Capture(Payload val) {
8585
if (!stack_.empty()) {
86-
auto& last = stack_.top();
87-
last.first->arr.push_back(std::move(val));
88-
if (collapse_if_needed && last.second-- == 1) {
89-
CollapseFilledCollections();
90-
}
86+
stack_.top().first->arr.push_back(std::move(val));
87+
stack_.top().second--;
9188
} else {
9289
DCHECK_EQ(current_.index(), 0u);
9390
current_ = std::move(val);
9491
}
92+
93+
// Check if we filled up a collection.
94+
CollapseFilledCollections();
9595
}
9696

9797
void CapturingReplyBuilder::CollapseFilledCollections() {
9898
while (!stack_.empty() && stack_.top().second == 0) {
9999
auto pl = std::move(stack_.top());
100100
stack_.pop();
101-
Capture(std::move(pl.first), false);
101+
Capture(std::move(pl.first));
102102
}
103103
}
104104

src/facade/reply_capture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class CapturingReplyBuilder : public RedisReplyBuilder {
7979
void SendDirect(Payload&& val);
8080

8181
// Capture value and store eiter in current topmost collection or as a standalone value.
82-
void Capture(Payload val, bool collapse_if_needed = true);
82+
void Capture(Payload val);
8383

8484
// While topmost collection in stack is full, finalize it and add it as a regular value.
8585
void CollapseFilledCollections();

0 commit comments

Comments
 (0)