You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/05/16 11:28:50 UTC

[GitHub] [incubator-brpc] wwbmmm commented on a diff in pull request #1763: fix rpc_press can't send request equably

wwbmmm commented on code in PR #1763:
URL: https://github.com/apache/incubator-brpc/pull/1763#discussion_r873614624


##########
tools/rpc_press/rpc_press_impl.cpp:
##########
@@ -219,14 +219,8 @@ void RpcPress::sync_client() {
     }
     const int thread_index = g_thread_count.fetch_add(1, butil::memory_order_relaxed);
     int msg_index = thread_index;
-    std::deque<int64_t> timeq;
-    size_t MAX_QUEUE_SIZE = (size_t)req_rate;
-    if (MAX_QUEUE_SIZE < 100) {
-        MAX_QUEUE_SIZE = 100;
-    } else if (MAX_QUEUE_SIZE > 2000) {
-        MAX_QUEUE_SIZE = 2000;
-    }
-    timeq.push_back(butil::gettimeofday_us());
+    int64_t last_expected_time = butil::gettimeofday_us();
+    const int64_t interval = (int64_t) (1000000 / req_rate);

Review Comment:
   如果req_rate > 100000 (虽然实际上极少出现),会导致interval变成0
   而原来的代码还能处理这种情况



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org