Add source to cancel_upload_file.

This commit is contained in:
levlam 2022-11-21 14:33:19 +03:00
parent 2849a0857b
commit 68627a0c3f
3 changed files with 8 additions and 8 deletions

View File

@ -9358,7 +9358,7 @@ void MessagesManager::on_load_secret_thumbnail(FileId thumbnail_file_id, BufferS
// message has already been deleted by the user, do not need to send it
// cancel file upload of the main file to allow next upload with the same file to succeed
LOG(INFO) << "Message with a media has already been deleted";
cancel_upload_file(file_id);
cancel_upload_file(file_id, "on_load_secret_thumbnail");
return;
}
CHECK(m->message_id.is_yet_unsent());
@ -25866,18 +25866,18 @@ void MessagesManager::cancel_upload_message_content_files(const MessageContent *
auto file_id = get_message_content_upload_file_id(content);
// always cancel file upload, it should be a no-op in the worst case
if (being_uploaded_files_.erase(file_id) || file_id.is_valid()) {
cancel_upload_file(file_id);
cancel_upload_file(file_id, "cancel_upload_message_content_files");
}
file_id = get_message_content_thumbnail_file_id(content, td_);
if (being_uploaded_thumbnails_.erase(file_id) || file_id.is_valid()) {
cancel_upload_file(file_id);
cancel_upload_file(file_id, "cancel_upload_message_content_files");
}
}
void MessagesManager::cancel_upload_file(FileId file_id) {
void MessagesManager::cancel_upload_file(FileId file_id, const char *source) {
// send the request later so they doesn't interfere with other actions
// for example merge, supposed to happen soon, can auto-cancel the upload
LOG(INFO) << "Cancel upload of file " << file_id;
LOG(INFO) << "Cancel upload of file " << file_id << " from " << source;
send_closure_later(G()->file_manager(), &FileManager::cancel_upload, file_id);
}
@ -37032,7 +37032,7 @@ bool MessagesManager::update_message_content(DialogId dialog_id, Message *old_me
if (need_finish_upload) {
// the file is likely to be already merged with a server file, but if not we need to
// cancel file upload of the main file to allow next upload with the same file to succeed
cancel_upload_file(old_file_id);
cancel_upload_file(old_file_id, "update_message_content");
}
if (is_content_changed || need_update) {

View File

@ -2969,7 +2969,7 @@ class MessagesManager final : public Actor {
void cancel_upload_message_content_files(const MessageContent *content);
static void cancel_upload_file(FileId file_id);
static void cancel_upload_file(FileId file_id, const char *source);
void cancel_send_message_query(DialogId dialog_id, Message *m);

View File

@ -1550,7 +1550,7 @@ Status FileManager::merge(FileId x_file_id, FileId y_file_id, bool no_sync) {
y_node->set_upload_pause(FileId());
}
LOG(DEBUG) << "Merge new file " << x_file_id << " and old file " << y_file_id;
LOG(INFO) << "Merge new file " << x_file_id << " and old file " << y_file_id;
if (x_node->remote_.full && y_node->remote_.full && !x_node->remote_.full.value().is_web() &&
!y_node->remote_.full.value().is_web() && y_node->remote_.is_full_alive &&
x_node->remote_.full_source == FileLocationSource::FromServer &&