Disable quick ack if reused media is sent.

GitOrigin-RevId: 4e1166d9fd2faf103c3f59775565fc510906d02d
This commit is contained in:
levlam 2019-12-06 00:39:39 +03:00
parent 6520bdea85
commit 797a117b60

View File

@ -2127,15 +2127,7 @@ class SendMultiMediaActor : public NetActorOnce {
auto query = G()->net_query_creator().create(create_storer(telegram_api::messages_sendMultiMedia( auto query = G()->net_query_creator().create(create_storer(telegram_api::messages_sendMultiMedia(
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(input_peer), flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(input_peer),
reply_to_message_id.get_server_message_id().get(), std::move(input_single_media), schedule_date))); reply_to_message_id.get_server_message_id().get(), std::move(input_single_media), schedule_date)));
if (G()->shared_config().get_option_boolean("use_quick_ack")) { // no quick ack, because file reference errors are very likely to happen
query->quick_ack_promise_ = PromiseCreator::lambda(
[random_ids = random_ids_](Unit) {
for (auto random_id : random_ids) {
send_closure(G()->messages_manager(), &MessagesManager::on_send_message_get_quick_ack, random_id);
}
},
PromiseCreator::Ignore());
}
query->debug("send to MessagesManager::MultiSequenceDispatcher"); query->debug("send to MessagesManager::MultiSequenceDispatcher");
send_closure(td->messages_manager_->sequence_dispatcher_, &MultiSequenceDispatcher::send_with_callback, send_closure(td->messages_manager_->sequence_dispatcher_, &MultiSequenceDispatcher::send_with_callback,
std::move(query), actor_shared(this), sequence_dispatcher_id); std::move(query), actor_shared(this), sequence_dispatcher_id);
@ -2251,7 +2243,7 @@ class SendMediaActor : public NetActorOnce {
std::move(entities), schedule_date); std::move(entities), schedule_date);
LOG(INFO) << "Send media: " << to_string(request); LOG(INFO) << "Send media: " << to_string(request);
auto query = G()->net_query_creator().create(create_storer(request)); auto query = G()->net_query_creator().create(create_storer(request));
if (G()->shared_config().get_option_boolean("use_quick_ack")) { if (G()->shared_config().get_option_boolean("use_quick_ack") && was_uploaded_) {
query->quick_ack_promise_ = PromiseCreator::lambda( query->quick_ack_promise_ = PromiseCreator::lambda(
[random_id](Unit) { [random_id](Unit) {
send_closure(G()->messages_manager(), &MessagesManager::on_send_message_get_quick_ack, random_id); send_closure(G()->messages_manager(), &MessagesManager::on_send_message_get_quick_ack, random_id);