Add disable_persistent_network_statistics option.
GitOrigin-RevId: 214f63dec6317949fe13cf1d2fece7e249ddafcb
This commit is contained in:
parent
9072b73337
commit
b1ad61add3
@ -5200,6 +5200,9 @@ void Td::on_request(uint64 id, td_api::optimizeStorage &request) {
|
||||
|
||||
void Td::on_request(uint64 id, td_api::getNetworkStatistics &request) {
|
||||
CREATE_REQUEST_PROMISE();
|
||||
if (!request.only_current_ && G()->shared_config().get_option_boolean("disable_persistent_network_statistics")) {
|
||||
return send_error_raw(id, 400, "Persistent network statistics is disabled");
|
||||
}
|
||||
auto query_promise = PromiseCreator::lambda([promise = std::move(promise)](Result<NetworkStats> result) mutable {
|
||||
if (result.is_error()) {
|
||||
promise.set_error(result.move_as_error());
|
||||
@ -7001,6 +7004,9 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
|
||||
if (!is_bot && set_boolean_option("disable_top_chats")) {
|
||||
return;
|
||||
}
|
||||
if (set_boolean_option("disable_persistent_network_statistics")) {
|
||||
return;
|
||||
}
|
||||
if (request.name_ == "drop_notification_ids") {
|
||||
G()->td_db()->get_binlog_pmc()->erase("notification_id_current");
|
||||
G()->td_db()->get_binlog_pmc()->erase("notification_group_id_current");
|
||||
|
@ -291,6 +291,10 @@ void NetStatsManager::update(NetStatsInfo &info, bool force_save) {
|
||||
}
|
||||
|
||||
void NetStatsManager::save_stats(NetStatsInfo &info, NetType net_type) {
|
||||
if (G()->shared_config().get_option_boolean("disable_persistent_network_statistics")) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto net_type_i = static_cast<size_t>(net_type);
|
||||
auto &type_stats = info.stats_by_type[net_type_i];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user