AntiTopQuark commented on code in PR #2498:
URL: https://github.com/apache/kvrocks/pull/2498#discussion_r1730203435


##########
src/server/server.cc:
##########
@@ -2115,3 +2122,40 @@ AuthResult Server::AuthenticateUser(const std::string 
&user_password, std::strin
   *ns = kDefaultNamespace;
   return AuthResult::IS_ADMIN;
 }
+
+void Server::evictionClients() {
+  size_t mem = 0;
+  for (const auto &t : worker_threads_) {
+    mem += t->GetWorker()->GetConnectionsMemoryUsed();
+  }
+  if (mem < config_->max_memory_clients) {
+    return;
+  }
+
+  std::vector<redis::Connection *> conns;
+  for (const auto &t : worker_threads_) {
+    auto worker_conns = t->GetWorker()->GetConnections();
+    for (const auto &iter : worker_conns) {
+      conns.push_back(iter.second);

Review Comment:
   I referred to the implementation of the `void 
Server::decreaseWorkerThreads(size_t delta)` function, which is also called 
without locking.
   
https://github.com/AntiTopQuark/kvrocks/blob/43f14db05f73d02a6fefc95347fd5c79781f85a5/src/server/server.cc#L1895



-- 
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