Skip to content

Commit 59a8c36

Browse files
authored
chore: replace chrono with absl in PipelineCacheSizeTracker (#4748)
Signed-off-by: kostas <[email protected]>
1 parent 611e9b3 commit 59a8c36

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/facade/dragonfly_connection.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include <absl/container/flat_hash_map.h>
88
#include <absl/strings/match.h>
99
#include <absl/strings/str_cat.h>
10+
#include <absl/time/time.h>
1011
#include <mimalloc.h>
1112

12-
#include <chrono>
1313
#include <numeric>
1414
#include <variant>
1515

@@ -323,26 +323,24 @@ thread_local vector<Connection::PipelineMessagePtr> Connection::pipeline_req_poo
323323
class PipelineCacheSizeTracker {
324324
public:
325325
bool CheckAndUpdateWatermark(size_t pipeline_sz) {
326-
const auto now = Clock::now();
326+
const auto now = absl::Now();
327327
const auto elapsed = now - last_check_;
328328
min_ = std::min(min_, pipeline_sz);
329-
if (elapsed < std::chrono::milliseconds(10)) {
329+
if (elapsed < absl::Milliseconds(10)) {
330330
return false;
331331
}
332332

333333
const bool watermark_reached = (min_ > 0);
334334
min_ = Limits::max();
335-
last_check_ = Clock::now();
335+
last_check_ = absl::Now();
336336

337337
return watermark_reached;
338338
}
339339

340340
private:
341-
using Tp = std::chrono::time_point<std::chrono::system_clock>;
342-
using Clock = std::chrono::system_clock;
343341
using Limits = std::numeric_limits<size_t>;
344342

345-
Tp last_check_ = Clock::now();
343+
absl::Time last_check_ = absl::Now();
346344
size_t min_ = Limits::max();
347345
};
348346

0 commit comments

Comments
 (0)