torwig commented on code in PR #1842:
URL: https://github.com/apache/kvrocks/pull/1842#discussion_r1366917307


##########
src/server/server.cc:
##########
@@ -232,8 +232,12 @@ void Server::Stop() {
 }
 
 void Server::Join() {
-  for (const auto &worker : worker_threads_) {
-    worker->Join();
+//  for (const auto &worker : worker_threads_) {

Review Comment:
   This commented code should be removed.



##########
src/server/server.cc:
##########
@@ -232,8 +232,12 @@ void Server::Stop() {
 }
 
 void Server::Join() {
-  for (const auto &worker : worker_threads_) {
-    worker->Join();
+//  for (const auto &worker : worker_threads_) {
+//    worker->Join();
+//    LOG(INFO) << "worker_threads_ len: " <<worker_threads_.size();
+//  }
+  for (int i = 0; i < (int )worker_threads_.size(); ++i) {

Review Comment:
   Could you please use `auto` / `size_t` instead of `int` here?



##########
src/server/server.cc:
##########
@@ -1863,3 +1867,77 @@ std::string Server::GetKeyNameFromCursor(const 
std::string &cursor, CursorType c
 
   return {};
 }
+
+Status Server::AdjustWorkerThreadNum(int new_num) {
+  int now_num = (int)worker_threads_.size();
+  LOG(INFO) << __func__ << ", now_num: " << now_num << ", new_num: " << 
new_num;

Review Comment:
   I guess it's here just for usage only during the development process?



##########
src/server/server.cc:
##########
@@ -1863,3 +1867,77 @@ std::string Server::GetKeyNameFromCursor(const 
std::string &cursor, CursorType c
 
   return {};
 }
+
+Status Server::AdjustWorkerThreadNum(int new_num) {
+  int now_num = (int)worker_threads_.size();
+  LOG(INFO) << __func__ << ", now_num: " << now_num << ", new_num: " << 
new_num;
+
+  if (now_num == new_num) {
+    return Status::OK();
+  } else if (now_num < new_num) {

Review Comment:
   You delete `else` and write the rest of the logic without indentation due to 
an early return before.



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