PragmaTwice commented on code in PR #1490:
URL:
https://github.com/apache/incubator-kvrocks/pull/1490#discussion_r1231886579
##########
src/commands/cmd_zset.cc:
##########
@@ -221,64 +223,217 @@ class CommandZLexCount : public Commander {
RangeLexSpec spec_;
};
-class CommandZPop : public Commander {
+class CommandZPop : public Commander,
+ private EvbufCallbackBase<CommandZPop, false>,
+ private EventCallbackBase<CommandZPop> {
public:
- explicit CommandZPop(bool min) : min_(min) {}
+ explicit CommandZPop(bool min, bool block) : min_(min), block_(block) {}
Review Comment:
Sorry but, I actually can hardly find the benefit of merging the code for
`BZPOP` and `ZPOP`. Most of I can see are lots of `if (block_)` checks to
implement different logic separately, which seems just make the code more
unreadable.
If you want to merge some thing to prevent duplication, I think you need to
find some **common logic** so that these code can be treated uniformly rather
than just put more `if`s, e.g.
```
f() { block a ... }
g() { block b ... }
// that is NOT a deduplication
h() { if(...) { block a ...} else { block b ... } }
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]