| 673 | } |
| 674 | |
| 675 | void Server::UnblockOnStreams(const std::vector<std::string> &keys, redis::Connection *conn) { |
| 676 | std::lock_guard<std::mutex> guard(blocked_stream_consumers_mu_); |
| 677 | |
| 678 | DecrBlockedClientNum(); |
| 679 | |
| 680 | for (const auto &key : keys) { |
| 681 | auto iter = blocked_stream_consumers_.find(key); |
| 682 | if (iter == blocked_stream_consumers_.end()) { |
| 683 | continue; |
| 684 | } |
| 685 | |
| 686 | for (auto it = iter->second.begin(); it != iter->second.end();) { |
| 687 | const auto &consumer = *it; |
| 688 | if (conn->GetFD() == consumer->fd && conn->Owner() == consumer->owner) { |
| 689 | iter->second.erase(it); |
| 690 | if (iter->second.empty()) { |
| 691 | blocked_stream_consumers_.erase(iter); |
| 692 | } |
| 693 | break; |
| 694 | } |
| 695 | ++it; |
| 696 | } |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | void Server::WakeupBlockingConns(const std::string &key, size_t n_conns) { |
| 701 | std::lock_guard<std::mutex> guard(blocking_keys_mu_); |
no test coverage detected