Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][compile] Resolve time_point type mismatch on MacOS and Linux #34054

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions be/src/util/s3_rate_limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#include "util/s3_util.h"
#include "util/spinlock.h"
#include "util/time.h"
#if defined(__APPLE__)
#include <ctime>
#define CURRENT_TIME std::chrono::system_clock::now()
#else
#define CURRENT_TIME std::chrono::high_resolution_clock::now()
#endif

namespace doris {
// Just 10^6.
Expand Down Expand Up @@ -51,8 +57,7 @@ std::pair<size_t, double> S3RateLimiter::_update_remain_token(

int64_t S3RateLimiter::add(size_t amount) {
// Values obtained under lock to be checked after release
auto [count_value, tokens_value] =
_update_remain_token(std::chrono::high_resolution_clock::now(), amount);
auto [count_value, tokens_value] = _update_remain_token(CURRENT_TIME, amount);

if (_limit && count_value > _limit) {
// CK would throw exception
Expand Down
Loading