Reload all data when going online.
This commit is contained in:
parent
6790c309ac
commit
f1f6e61cd1
@ -623,10 +623,10 @@ void OptionManager::set_option(const string &name, td_api::object_ptr<td_api::Op
|
||||
}
|
||||
bool is_online = value_constructor_id == td_api::optionValueEmpty::ID ||
|
||||
static_cast<const td_api::optionValueBoolean *>(value.get())->value_;
|
||||
td_->set_is_online(is_online);
|
||||
if (!is_bot) {
|
||||
send_closure(td_->state_manager_, &StateManager::on_online, is_online);
|
||||
}
|
||||
td_->set_is_online(is_online);
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
break;
|
||||
|
@ -183,6 +183,24 @@ void UpdatesManager::tear_down() {
|
||||
LOG(DEBUG) << "Have " << being_processed_updates_ << " unprocessed updates to apply";
|
||||
}
|
||||
|
||||
void UpdatesManager::start_up() {
|
||||
class StateCallback final : public StateManager::Callback {
|
||||
public:
|
||||
explicit StateCallback(ActorId<UpdatesManager> parent) : parent_(std::move(parent)) {
|
||||
}
|
||||
bool on_online(bool is_online) final {
|
||||
if (is_online) {
|
||||
send_closure(parent_, &UpdatesManager::try_reload_data);
|
||||
}
|
||||
return parent_.is_alive();
|
||||
}
|
||||
|
||||
private:
|
||||
ActorId<UpdatesManager> parent_;
|
||||
};
|
||||
send_closure(G()->state_manager(), &StateManager::add_callback, make_unique<StateCallback>(actor_id(this)));
|
||||
}
|
||||
|
||||
void UpdatesManager::hangup_shared() {
|
||||
ref_cnt_--;
|
||||
if (ref_cnt_ == 0) {
|
||||
|
@ -227,6 +227,8 @@ class UpdatesManager final : public Actor {
|
||||
int32 min_postponed_update_pts_ = 0;
|
||||
int32 min_postponed_update_qts_ = 0;
|
||||
|
||||
void start_up() final;
|
||||
|
||||
void tear_down() final;
|
||||
|
||||
void hangup_shared() final;
|
||||
|
Loading…
Reference in New Issue
Block a user