Skip to content

Commit

Permalink
remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
LindaSummer committed Aug 1, 2024
1 parent 965ee92 commit b42ca2d
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/server/worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,10 @@ Worker::Worker(Server *srv, Config *config) : srv(srv), base_(event_base_new())
}

Worker::~Worker() {
// std::vector<redis::Connection *> conns;
// conns.reserve(conns_.size() + monitor_conns_.size());
{
std::lock_guard<std::mutex> guard(conns_mu_);
for (const auto &iter : conns_) {
if (ConnMap::accessor accessor; conns_.find(accessor, iter.first)) {
// conns.emplace_back(accessor->second);
accessor->second->Close();
}
}
Expand All @@ -93,14 +90,10 @@ Worker::~Worker() {
std::lock_guard<std::mutex> guard(conns_mu_);
for (const auto &iter : monitor_conns_) {
if (ConnMap::accessor accessor; monitor_conns_.find(accessor, iter.first)) {
// conns.emplace_back(accessor->second);
accessor->second->Close();
}
}
}
// for (const auto &iter : conns) {
// iter->Close();
// }

timer_.reset();
if (rate_limit_group_) {
Expand Down Expand Up @@ -477,9 +470,9 @@ void Worker::BecomeMonitorConn(redis::Connection *conn) {
}

void Worker::QuitMonitorConn(redis::Connection *conn) {
std::lock_guard<std::mutex> guard(conns_mu_);
if (ConnMap::accessor accessor; monitor_conns_.find(accessor, conn->GetFD())) {
{
std::lock_guard<std::mutex> guard(conns_mu_);
monitor_conns_.erase(accessor);
accessor.release();
}
Expand Down

0 comments on commit b42ca2d

Please sign in to comment.