| 771 | } |
| 772 | |
| 773 | void Server::WakeupWaitConnection(redis::Connection *conn, rocksdb::SequenceNumber seq) { |
| 774 | std::unique_lock<std::shared_mutex> guard(wait_contexts_mu_); |
| 775 | cleanupWaitConnection(conn); |
| 776 | |
| 777 | size_t reached_replicas = GetReplicasReachedSequence(seq); |
| 778 | conn->Reply(redis::Integer(reached_replicas)); |
| 779 | |
| 780 | auto s = conn->Owner()->EnableWriteEvent(conn->GetFD()); |
| 781 | if (!s.IsOK()) { |
| 782 | ERROR("[server] Failed to enable write event on WAIT connection {}: {}", conn->GetFD(), s.Msg()); |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | void Server::CleanupWaitConnection(redis::Connection *conn) { |
| 787 | std::unique_lock<std::shared_mutex> guard(wait_contexts_mu_); |