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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]