Properly init MessagesManager.

GitOrigin-RevId: 10bd6a41a479389afdbf6d621025bba766f8e850
This commit is contained in:
levlam 2019-01-06 01:25:09 +03:00
parent 78a0a37afb
commit 027c1eafc4
2 changed files with 14 additions and 1 deletions

View File

@ -8735,6 +8735,15 @@ void MessagesManager::tear_down() {
}
void MessagesManager::start_up() {
init();
}
void MessagesManager::init() {
if (is_inited_) {
return;
}
is_inited_ = true;
always_wait_for_mailbox();
start_time_ = Time::now();
@ -17925,7 +17934,8 @@ vector<NotificationGroupKey> MessagesManager::get_message_notification_group_key
if (!G()->parameters().use_message_db) {
return {};
}
CHECK(start_time_ != 0); // ensure that MessagesManager was already inited in start_up
init();
VLOG(notifications) << "Trying to load " << limit << " message notification groups from database from "
<< from_group_key;

View File

@ -1790,6 +1790,8 @@ class MessagesManager : public Actor {
void loop() override;
void tear_down() override;
void init();
void ttl_db_loop_start(double server_now);
void ttl_db_loop(double server_now);
void ttl_db_on_result(Result<std::pair<std::vector<std::pair<DialogId, BufferSlice>>, int32>> r_result, bool dummy);
@ -2280,6 +2282,7 @@ class MessagesManager : public Actor {
DialogId being_added_dialog_id_;
double start_time_ = 0;
bool is_inited_ = false;
Td *td_;
ActorShared<> parent_;