Update TDLib and improve TQueue GC.

This commit is contained in:
levlam 2022-10-14 00:46:54 +03:00
parent 018b4fc6f7
commit aa05180325
3 changed files with 8 additions and 6 deletions

2
td

@ -1 +1 @@
Subproject commit c1a3fa633fbce67b8b89fee93130498db8adc039
Subproject commit ec86b34d557c031b0b07929734decc561315eac1

View File

@ -337,7 +337,7 @@ void ClientManager::start_up() {
LOG(WARNING) << "Loaded " << loaded_event_count << " TQueue events in " << (td::Time::now() - load_start_time)
<< " seconds";
last_tqueue_gc_time_ = td::Time::now();
next_tqueue_gc_time_ = td::Time::now() + 600;
}
// init webhook_db
@ -500,12 +500,14 @@ void ClientManager::timeout_expired() {
set_timeout_in(WATCHDOG_TIMEOUT / 2);
double now = td::Time::now();
if (now > last_tqueue_gc_time_ + 60.0) {
if (now > next_tqueue_gc_time_) {
auto unix_time = parameters_->shared_data_->get_unix_time(now);
LOG(INFO) << "Run TQueue GC at " << unix_time;
last_tqueue_gc_time_ = now;
auto deleted_events = parameters_->shared_data_->tqueue_->run_gc(unix_time);
td::int64 deleted_events;
bool is_finished;
std::tie(deleted_events, is_finished) = parameters_->shared_data_->tqueue_->run_gc(unix_time);
LOG(INFO) << "TQueue GC deleted " << deleted_events << " events";
next_tqueue_gc_time_ = td::Time::now() + (is_finished ? 60.0 : 1.0);
tqueue_deleted_events_ += deleted_events;
if (tqueue_deleted_events_ > last_tqueue_deleted_events_ + 10000) {

View File

@ -72,7 +72,7 @@ class ClientManager final : public td::Actor {
td::vector<td::Promise<td::Unit>> close_promises_;
td::ActorOwn<Watchdog> watchdog_id_;
double last_tqueue_gc_time_ = 0.0;
double next_tqueue_gc_time_ = 0.0;
td::int64 tqueue_deleted_events_ = 0;
td::int64 last_tqueue_deleted_events_ = 0;