github-actions[bot] commented on code in PR #27592:
URL: https://github.com/apache/doris/pull/27592#discussion_r1405548657


##########
be/src/agent/task_worker_pool.cpp:
##########
@@ -277,6 +277,22 @@ void TaskWorkerPool::notify_thread() {
     VLOG_CRITICAL << "notify task worker pool: " << _name;
 }
 
+bool TaskWorkerPool::_get_task(TAgentTaskRequest* task) {

Review Comment:
   warning: method '_get_task' can be made const 
[readability-make-member-function-const]
   
   ```suggestion
   bool TaskWorkerPool::_get_task(TAgentTaskRequest* task) const {
   ```
   



##########
be/src/agent/task_worker_pool.cpp:
##########
@@ -277,6 +277,22 @@
     VLOG_CRITICAL << "notify task worker pool: " << _name;
 }
 
+bool TaskWorkerPool::_get_task(TAgentTaskRequest* task) {
+    std::unique_lock<std::mutex> worker_thread_lock(_worker_thread_lock);
+    while (_is_work && _tasks.empty()) {
+        _worker_thread_condition_variable.wait(worker_thread_lock);
+    }
+
+    if (!_is_work) {
+        return false;

Review Comment:
   warning: redundant boolean literal in conditional return statement 
[readability-simplify-boolean-expr]
   
   be/src/agent/task_worker_pool.cpp:285:
   ```diff
   -     if (!_is_work) {
   -         return false;
   -     }
   - 
   -     *task = _tasks.front();
   -     _tasks.pop_front();
   - 
   -     return true;
   +     return _is_work;
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to