mirror of
https://github.com/dragonflydb/dragonfly
synced 2024-11-21 23:19:53 +00:00
Use sum instead of individual counts for channels/patterns (#119)
This commit is contained in:
parent
02bc4425ae
commit
746c04fb9d
@ -38,7 +38,7 @@ void ConnectionContext::ChangeSubscription(bool to_add, bool to_reply, CmdArgLis
|
||||
}
|
||||
|
||||
if (to_reply)
|
||||
result[i] = conn_state.subscribe_info->channels.size();
|
||||
result[i] = conn_state.subscribe_info->SubscriptionCount();
|
||||
|
||||
if (res) {
|
||||
ShardId sid = Shard(channel, shard_set->size());
|
||||
@ -132,7 +132,7 @@ void ConnectionContext::ChangePSub(bool to_add, bool to_reply, CmdArgList args)
|
||||
}
|
||||
|
||||
if (to_reply)
|
||||
result[i] = conn_state.subscribe_info->patterns.size();
|
||||
result[i] = conn_state.subscribe_info->SubscriptionCount();
|
||||
|
||||
if (res) {
|
||||
patterns.emplace_back(pattern);
|
||||
|
@ -58,6 +58,10 @@ struct ConnectionState {
|
||||
return channels.empty() && patterns.empty();
|
||||
}
|
||||
|
||||
unsigned SubscriptionCount() const {
|
||||
return channels.size() + patterns.size();
|
||||
}
|
||||
|
||||
SubscribeInfo() : borrow_token(0) {
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user