mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-08-28 10:05:27 +02:00
Update TDLib and improve TQueue GC.
This commit is contained in:
parent
018b4fc6f7
commit
aa05180325
2
td
2
td
@ -1 +1 @@
|
||||
Subproject commit c1a3fa633fbce67b8b89fee93130498db8adc039
|
||||
Subproject commit ec86b34d557c031b0b07929734decc561315eac1
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user