MCPcopy Create free account
hub / github.com/apache/kvrocks / PUnsubscribeChannel

Method PUnsubscribeChannel

src/server/server.cc:545–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543}
544
545void Server::PUnsubscribeChannel(const std::string &pattern, redis::Connection *conn) {
546 std::lock_guard<std::mutex> guard(pubsub_channels_mu_);
547
548 auto iter = pubsub_patterns_.find(pattern);
549 if (iter == pubsub_patterns_.end()) {
550 return;
551 }
552
553 for (const auto &conn_ctx : iter->second) {
554 if (conn->GetFD() == conn_ctx.fd && conn->Owner() == conn_ctx.owner) {
555 iter->second.remove(conn_ctx);
556 if (iter->second.empty()) {
557 pubsub_patterns_.erase(iter);
558 }
559 break;
560 }
561 }
562}
563
564void Server::SSubscribeChannel(const std::string &channel, redis::Connection *conn, uint16_t slot) {
565 assert((config_->cluster_enabled && slot < HASH_SLOTS_SIZE) || slot == 0);

Callers 1

ExecuteMethod · 0.45

Calls 3

endMethod · 0.80
GetFDMethod · 0.80
OwnerMethod · 0.80

Tested by

no test coverage detected