Fix retries in getBasicGroupFullInfo.

GitOrigin-RevId: acd566f171998c130f0e3a0544b11e6430148f07
This commit is contained in:
levlam 2020-03-30 22:20:34 +03:00
parent 10b1ac1c8a
commit e8e546a721
4 changed files with 8 additions and 8 deletions

View File

@ -11664,7 +11664,7 @@ bool ContactsManager::is_chat_full_outdated(const ChatFull *chat_full, const Cha
return false;
}
bool ContactsManager::get_chat_full(ChatId chat_id, Promise<Unit> &&promise) {
bool ContactsManager::get_chat_full(ChatId chat_id, bool force, Promise<Unit> &&promise) {
auto c = get_chat(chat_id);
if (c == nullptr) {
promise.set_error(Status::Error(6, "Group not found"));
@ -11680,7 +11680,7 @@ bool ContactsManager::get_chat_full(ChatId chat_id, Promise<Unit> &&promise) {
if (is_chat_full_outdated(chat_full, c, chat_id)) {
LOG(INFO) << "Have outdated full " << chat_id;
if (td_->auth_manager_->is_bot()) {
if (td_->auth_manager_->is_bot() && !force) {
send_get_chat_full_query(chat_id, std::move(promise), "get expired chat_full");
return false;
} else {
@ -12149,7 +12149,7 @@ DialogParticipant ContactsManager::get_chat_participant(ChatId chat_id, UserId u
LOG(INFO) << "Trying to get " << user_id << " as member of " << chat_id;
if (force) {
promise.set_value(Unit());
} else if (!get_chat_full(chat_id, std::move(promise))) {
} else if (!get_chat_full(chat_id, force, std::move(promise))) {
return DialogParticipant();
}
// promise is already set
@ -12174,7 +12174,7 @@ std::pair<int32, vector<DialogParticipant>> ContactsManager::search_chat_partici
if (force) {
promise.set_value(Unit());
} else if (!get_chat_full(chat_id, std::move(promise))) {
} else if (!get_chat_full(chat_id, force, std::move(promise))) {
return {};
}
// promise is already set
@ -12492,7 +12492,7 @@ void ContactsManager::on_update_dialog_administrators(DialogId dialog_id, vector
void ContactsManager::reload_dialog_administrators(DialogId dialog_id, int32 hash, Promise<Unit> &&promise) {
switch (dialog_id.get_type()) {
case DialogType::Chat:
get_chat_full(dialog_id.get_chat_id(), std::move(promise));
get_chat_full(dialog_id.get_chat_id(), false, std::move(promise));
break;
case DialogType::Channel:
td_->create_handler<GetChannelAdministratorsQuery>(std::move(promise))->send(dialog_id.get_channel_id(), hash);

View File

@ -434,7 +434,7 @@ class ContactsManager : public Actor {
bool have_chat_force(ChatId chat_id);
bool get_chat(ChatId chat_id, int left_tries, Promise<Unit> &&promise);
void reload_chat(ChatId chat_id, Promise<Unit> &&promise);
bool get_chat_full(ChatId chat_id, Promise<Unit> &&promise);
bool get_chat_full(ChatId chat_id, bool force, Promise<Unit> &&promise);
bool get_chat_is_active(ChatId chat_id) const;
DialogParticipantStatus get_chat_status(ChatId chat_id) const;

View File

@ -13769,7 +13769,7 @@ void MessagesManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&p
td_->contacts_manager_->get_user_full(dialog_id.get_user_id(), std::move(promise));
return;
case DialogType::Chat:
td_->contacts_manager_->get_chat_full(dialog_id.get_chat_id(), std::move(promise));
td_->contacts_manager_->get_chat_full(dialog_id.get_chat_id(), true, std::move(promise));
return;
case DialogType::Channel:
td_->contacts_manager_->get_channel_full(dialog_id.get_channel_id(), std::move(promise));

View File

@ -711,7 +711,7 @@ class GetGroupFullInfoRequest : public RequestActor<> {
ChatId chat_id_;
void do_run(Promise<Unit> &&promise) override {
td->contacts_manager_->get_chat_full(chat_id_, std::move(promise));
td->contacts_manager_->get_chat_full(chat_id_, get_tries() < 2, std::move(promise));
}
void do_send_result() override {