Improve source for error suppression.
This commit is contained in:
parent
ab14065168
commit
cc9de08be3
@ -487,6 +487,7 @@ class GetChannelMessagesQuery final : public Td::ResultHandler {
|
|||||||
Promise<Unit> promise_;
|
Promise<Unit> promise_;
|
||||||
ChannelId channel_id_;
|
ChannelId channel_id_;
|
||||||
MessageId last_new_message_id_;
|
MessageId last_new_message_id_;
|
||||||
|
bool can_be_inaccessible_ = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GetChannelMessagesQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
explicit GetChannelMessagesQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
@ -496,6 +497,7 @@ class GetChannelMessagesQuery final : public Td::ResultHandler {
|
|||||||
vector<tl_object_ptr<telegram_api::InputMessage>> &&message_ids, MessageId last_new_message_id) {
|
vector<tl_object_ptr<telegram_api::InputMessage>> &&message_ids, MessageId last_new_message_id) {
|
||||||
channel_id_ = channel_id;
|
channel_id_ = channel_id;
|
||||||
last_new_message_id_ = last_new_message_id;
|
last_new_message_id_ = last_new_message_id;
|
||||||
|
can_be_inaccessible_ = message_ids.size() == 1 && message_ids[0]->get_id() != telegram_api::inputMessageID::ID;
|
||||||
CHECK(input_channel != nullptr);
|
CHECK(input_channel != nullptr);
|
||||||
send_query(G()->net_query_creator().create(
|
send_query(G()->net_query_creator().create(
|
||||||
telegram_api::channels_getMessages(std::move(input_channel), std::move(message_ids))));
|
telegram_api::channels_getMessages(std::move(input_channel), std::move(message_ids))));
|
||||||
@ -523,16 +525,17 @@ class GetChannelMessagesQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
td_->messages_manager_->on_get_empty_messages(DialogId(channel_id_), empty_message_ids);
|
td_->messages_manager_->on_get_empty_messages(DialogId(channel_id_), empty_message_ids);
|
||||||
}
|
}
|
||||||
|
const char *source = can_be_inaccessible_ ? "GetRepliedChannelMessageQuery" : "GetChannelMessagesQuery";
|
||||||
td_->messages_manager_->get_channel_difference_if_needed(
|
td_->messages_manager_->get_channel_difference_if_needed(
|
||||||
DialogId(channel_id_), std::move(info),
|
DialogId(channel_id_), std::move(info),
|
||||||
PromiseCreator::lambda([actor_id = td_->messages_manager_actor_.get(),
|
PromiseCreator::lambda([actor_id = td_->messages_manager_actor_.get(), source,
|
||||||
promise = std::move(promise_)](Result<MessagesManager::MessagesInfo> &&result) mutable {
|
promise = std::move(promise_)](Result<MessagesManager::MessagesInfo> &&result) mutable {
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
promise.set_error(result.move_as_error());
|
promise.set_error(result.move_as_error());
|
||||||
} else {
|
} else {
|
||||||
auto info = result.move_as_ok();
|
auto info = result.move_as_ok();
|
||||||
send_closure(actor_id, &MessagesManager::on_get_messages, std::move(info.messages),
|
send_closure(actor_id, &MessagesManager::on_get_messages, std::move(info.messages),
|
||||||
info.is_channel_messages, false, std::move(promise), "GetChannelMessagesQuery");
|
info.is_channel_messages, false, std::move(promise), source);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -35674,9 +35677,9 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
|||||||
auto next_message = *it;
|
auto next_message = *it;
|
||||||
if (next_message != nullptr) {
|
if (next_message != nullptr) {
|
||||||
if (next_message->message_id.is_server() &&
|
if (next_message->message_id.is_server() &&
|
||||||
!(td_->auth_manager_->is_bot() && Slice(source) == Slice("GetChannelMessagesQuery"))) {
|
!(td_->auth_manager_->is_bot() && Slice(source) == Slice("GetRepliedChannelMessageQuery"))) {
|
||||||
LOG(ERROR) << "Can't attach " << m->message_id << " from " << source << " from "
|
LOG(ERROR) << "Can't attach " << m->message_id << " of type " << m->content->get_type() << " from " << source
|
||||||
<< (m->from_database ? "database" : "server") << " before " << next_message->message_id
|
<< " from " << (m->from_database ? "database" : "server") << " before " << next_message->message_id
|
||||||
<< " and after " << previous_message->message_id << " in " << dialog_id;
|
<< " and after " << previous_message->message_id << " in " << dialog_id;
|
||||||
dump_debug_message_op(d);
|
dump_debug_message_op(d);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user