github-actions[bot] commented on code in PR #39177: URL: https://github.com/apache/doris/pull/39177#discussion_r1712572183
########## be/src/runtime/workload_management/io_throttle.cpp: ########## @@ -42,32 +49,39 @@ bool IOThrottle::acquire(int64_t block_timeout_ms) { } bool IOThrottle::try_acquire() { - if (_io_bytes_per_second < 0) { + if (_io_bytes_per_second_limit < 0) { return true; } std::unique_lock<std::mutex> w_lock(_mutex); return GetCurrentTimeMicros() > _next_io_time_micros; } void IOThrottle::update_next_io_time(int64_t io_bytes) { - if (_io_bytes_per_second <= 0 || io_bytes <= 0) { + Defer defer {[&]() { + if (io_bytes > 0) { + (*_io_adder) << io_bytes; + } + }}; + if (_io_bytes_per_second_limit <= 0 || io_bytes <= 0) { return; } - int64_t read_bytes_per_second = _io_bytes_per_second; - std::unique_lock<std::mutex> w_lock(_mutex); - double io_bytes_float = static_cast<double>(io_bytes); - double ret = (io_bytes_float / static_cast<double>(read_bytes_per_second)) * - static_cast<double>(MICROS_PER_SEC); - int64_t current_time = GetCurrentTimeMicros(); + int64_t read_bytes_per_second = _io_bytes_per_second_limit; Review Comment: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto] ```suggestion auto io_bytes_float = static_cast<double>(io_bytes); ``` -- 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