Fix video story network statistics.
This commit is contained in:
parent
61eeab055a
commit
0ada45c361
@ -171,6 +171,13 @@ CSlice get_file_type_name(FileType file_type) {
|
||||
}
|
||||
}
|
||||
|
||||
CSlice get_file_type_unique_name(FileType file_type) {
|
||||
if (file_type == FileType::VideoStory) {
|
||||
return CSlice("video_stories");
|
||||
}
|
||||
return get_file_type_name(file_type);
|
||||
}
|
||||
|
||||
FileTypeClass get_file_type_class(FileType file_type) {
|
||||
switch (file_type) {
|
||||
case FileType::Photo:
|
||||
|
@ -53,6 +53,8 @@ FileType get_main_file_type(FileType file_type);
|
||||
|
||||
CSlice get_file_type_name(FileType file_type);
|
||||
|
||||
CSlice get_file_type_unique_name(FileType file_type);
|
||||
|
||||
enum class FileTypeClass : int32 { Photo, Document, Secure, Encrypted, Temp };
|
||||
|
||||
FileTypeClass get_file_type_class(FileType file_type);
|
||||
|
@ -146,7 +146,7 @@ void NetStatsManager::reset_network_stats() {
|
||||
for (size_t net_type_i = 0; net_type_i < net_type_size(); net_type_i++) {
|
||||
auto net_type = NetType(net_type_i);
|
||||
info.stats_by_type[net_type_i] = NetStatsInfo::TypeStats{};
|
||||
auto key = PSTRING() << info.key << "#" << net_type_string(net_type);
|
||||
auto key = PSTRING() << info.key << '#' << net_type_string(net_type);
|
||||
G()->td_db()->get_binlog_pmc()->erase(key);
|
||||
}
|
||||
};
|
||||
@ -197,7 +197,7 @@ void NetStatsManager::start_up() {
|
||||
|
||||
for (size_t net_type_i = 0; net_type_i < net_type_size(); net_type_i++) {
|
||||
auto net_type = NetType(net_type_i);
|
||||
auto key = PSTRING() << info.key << "#" << net_type_string(net_type);
|
||||
auto key = PSTRING() << info.key << '#' << net_type_string(net_type);
|
||||
|
||||
auto value = G()->td_db()->get_binlog_pmc()->get(key);
|
||||
if (value.empty()) {
|
||||
@ -296,9 +296,9 @@ void NetStatsManager::save_stats(NetStatsInfo &info, NetType net_type) {
|
||||
auto net_type_i = static_cast<size_t>(net_type);
|
||||
auto &type_stats = info.stats_by_type[net_type_i];
|
||||
|
||||
auto key = PSTRING() << info.key << "#" << net_type_string(info.net_type);
|
||||
auto key = PSTRING() << info.key << '#' << net_type_string(info.net_type);
|
||||
auto stats = type_stats.mem_stats + type_stats.db_stats;
|
||||
// LOG(ERROR) << "SAVE " << key << " " << stats;
|
||||
// LOG(ERROR) << "SAVE " << key << ' ' << stats;
|
||||
|
||||
G()->td_db()->get_binlog_pmc()->set(key, log_event_store(stats).as_slice().str());
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class NetStatsManager final : public Actor {
|
||||
for (int32 file_type_i = 0; file_type_i < MAX_FILE_TYPE; file_type_i++) {
|
||||
auto &stat = files_stats_[file_type_i];
|
||||
auto file_type = static_cast<FileType>(file_type_i);
|
||||
f(stat, file_type_i + 2, get_file_type_name(file_type), file_type);
|
||||
f(stat, file_type_i + 2, get_file_type_unique_name(file_type), file_type);
|
||||
}
|
||||
f(call_net_stats_, CALL_NET_STATS_ID, CSlice("calls"), FileType::None);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user