Fix file statistics after forwarding files to secret chat.
GitOrigin-RevId: 9ae1f492fe003da011622effadc143e9aad517e9
This commit is contained in:
parent
15dda847f4
commit
d375ff0f29
@ -37,6 +37,7 @@ void StorageManager::start_up() {
|
||||
}
|
||||
|
||||
void StorageManager::on_new_file(int64 size, int32 cnt) {
|
||||
LOG(INFO) << "Add " << cnt << " file of size " << size << " to fast storage statistics";
|
||||
fast_stat_.cnt += cnt;
|
||||
fast_stat_.size += size;
|
||||
|
||||
@ -171,10 +172,13 @@ void StorageManager::load_fast_stat() {
|
||||
if (status.is_error()) {
|
||||
fast_stat_ = FileTypeStat();
|
||||
}
|
||||
LOG(INFO) << "Loaded fast storage statistics with " << fast_stat_.cnt << " files of total size " << fast_stat_.size;
|
||||
}
|
||||
|
||||
void StorageManager::send_stats(FileStats &&stats, int32 dialog_limit, std::vector<Promise<FileStats>> promises) {
|
||||
fast_stat_ = stats.get_total_nontemp_stat();
|
||||
LOG(INFO) << "Recalculate fast storage statistics to " << fast_stat_.cnt << " files of total size "
|
||||
<< fast_stat_.size;
|
||||
save_fast_stat();
|
||||
|
||||
stats.apply_dialog_limit(dialog_limit);
|
||||
|
@ -2557,9 +2557,12 @@ void FileManager::on_generate_ok(QueryId query_id, const FullLocalFileLocation &
|
||||
if (status.is_error()) {
|
||||
return on_error_impl(file_node, query.type_, was_active, std::move(status));
|
||||
}
|
||||
|
||||
CHECK(file_node);
|
||||
context_->on_new_file(FileView(file_node).size(), 1);
|
||||
|
||||
FileView file_view(file_node);
|
||||
if (!file_view.has_generate_location() || !begins_with(file_view.generate_location().conversion_, "#file_id#")) {
|
||||
context_->on_new_file(file_view.size(), 1);
|
||||
}
|
||||
|
||||
run_upload(file_node, {});
|
||||
|
||||
|
Reference in New Issue
Block a user