Better logging for results of getChannelParticipant.

GitOrigin-RevId: 08918a4577fa4e7337903e221a96ceb3534c11a4
This commit is contained in:
levlam 2019-12-25 20:31:27 +03:00
parent 82c55c51a0
commit 1fc1b76d5e
2 changed files with 6 additions and 3 deletions

View File

@ -11954,7 +11954,7 @@ std::pair<int32, vector<DialogParticipant>> ContactsManager::search_chat_partici
DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id, UserId user_id, int64 &random_id,
bool force, Promise<Unit> &&promise) {
LOG(INFO) << "Trying to get " << user_id << " as member of " << channel_id;
LOG(INFO) << "Trying to get " << user_id << " as member of " << channel_id << " with random_id " << random_id;
if (random_id != 0) {
// request has already been sent before
auto it = received_channel_participant_.find(random_id);
@ -11989,11 +11989,13 @@ DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id,
} while (random_id == 0 || received_channel_participant_.find(random_id) != received_channel_participant_.end());
received_channel_participant_[random_id]; // reserve place for result
LOG(DEBUG) << "Get info about " << user_id << " membership in the " << channel_id;
LOG(DEBUG) << "Get info about " << user_id << " membership in the " << channel_id << " with random_id " << random_id;
auto on_result_promise = PromiseCreator::lambda(
[this, random_id, promise = std::move(promise)](Result<DialogParticipant> r_dialog_participant) mutable {
// ResultHandlers are cleared before managers, so it is safe to capture this
LOG(INFO) << "Receive a member of a channel with random_id " << random_id;
auto it = received_channel_participant_.find(random_id);
CHECK(it != received_channel_participant_.end());

View File

@ -24833,7 +24833,8 @@ void MessagesManager::set_dialog_participant_status(DialogId dialog_id, UserId u
DialogParticipant MessagesManager::get_dialog_participant(DialogId dialog_id, UserId user_id, int64 &random_id,
bool force, Promise<Unit> &&promise) {
LOG(INFO) << "Receive GetChatMember request to get " << user_id << " in " << dialog_id;
LOG(INFO) << "Receive GetChatMember request to get " << user_id << " in " << dialog_id << " with random_id "
<< random_id;
if (!have_dialog_force(dialog_id)) {
promise.set_error(Status::Error(3, "Chat not found"));
return DialogParticipant();