LindaSummer commented on code in PR #2461:
URL: https://github.com/apache/kvrocks/pull/2461#discussion_r1703265930


##########
src/server/worker.cc:
##########
@@ -76,17 +77,22 @@ 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());
-
-  for (const auto &iter : conns_) {
-    conns.emplace_back(iter.second);
-  }
-  for (const auto &iter : monitor_conns_) {
-    conns.emplace_back(iter.second);
+  {
+    std::lock_guard<std::mutex> guard(conns_mu_);
+    for (const auto &iter : conns_) {
+      if (ConnMap::accessor accessor; conns_.find(accessor, iter.first)) {
+        accessor->second->Close();

Review Comment:
   Hi @mapleFU ,
   Sorry for delay reply.
   Thanks for your patience and suggestions!
   
   I have updated code with `tbb::parallel_reduce` to collect the connections 
and close them out of tbb loop.
   
   Best Regards,
   Edward



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to