Skip to content

Commit

Permalink
Remove promise from map before setting it.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: d721cab5311096631748e632cf8756edaef9d7e1
  • Loading branch information
levlam committed Oct 23, 2020
1 parent f5c4b93 commit bf945e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions td/telegram/MessagesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23161,11 +23161,14 @@ void MessagesManager::on_yet_unsent_media_queue_updated(DialogId dialog_id) {
}

auto m = get_message({dialog_id, MessageId(first_it->first)});
auto promise = std::move(first_it->second);
queue.erase(first_it);
if (m != nullptr) {
LOG(INFO) << "Can send " << FullMessageId{dialog_id, m->message_id};
first_it->second.set_value(std::move(m));
promise.set_value(std::move(m));
} else {
promise.set_error(Status::Error(400, "Message not found"));
}
queue.erase(first_it);
}
LOG(INFO) << "Queue for " << dialog_id << " now has size " << queue.size();
if (queue.empty()) {
Expand Down

0 comments on commit bf945e0

Please sign in to comment.