Minor improvements.

GitOrigin-RevId: 45477784ae1840f217b9394e3d0cc56e1241f9ce
This commit is contained in:
levlam 2020-08-07 22:14:42 +03:00
parent 037bfb3776
commit fe5bf41980
2 changed files with 7 additions and 4 deletions

View File

@ -231,7 +231,7 @@ class TQueueImpl : public TQueue {
}
do_get(queue_id, q, from_id, forget_previous, unix_time_now, result_events);
return get_size(queue_id);
return get_size(q);
}
int64 run_gc(int32 unix_time_now) override {
@ -293,7 +293,7 @@ class TQueueImpl : public TQueue {
std::set<std::pair<int32, QueueId>> queue_gc_at_;
unique_ptr<StorageCallback> callback_;
size_t get_size(Queue &q) {
static size_t get_size(Queue &q) {
if (q.events.empty()) {
return 0;
}

View File

@ -7,9 +7,11 @@
#pragma once
#if TD_PORT_POSIX
#include "td/utils/common.h"
#include "td/utils/Time.h"
#include <cerrno>
#include <type_traits>
#include "td/utils/Time.h"
#endif
namespace td {
@ -50,7 +52,8 @@ auto skip_eintr_timeout(F &&f, int32 timeout_ms) {
if (res >= 0 || errno != EINTR) {
break;
}
left_timeout_ms = max(static_cast<int32>((start.at() - Timestamp::now().at()) * 1000 + timeout_ms + 1 - 1e-9), 0);
left_timeout_ms =
td::max(static_cast<int32>((start.at() - Timestamp::now().at()) * 1000 + timeout_ms + 1 - 1e-9), 0);
}
return res;
}