Fix network stats since_date by authorization date.
GitOrigin-RevId: 6842226e768d1d500e60eec1491b6adbda1098a5
This commit is contained in:
parent
6a56320b06
commit
8bece302a8
@ -9,6 +9,7 @@
|
|||||||
#include "td/actor/actor.h"
|
#include "td/actor/actor.h"
|
||||||
#include "td/actor/PromiseFuture.h"
|
#include "td/actor/PromiseFuture.h"
|
||||||
|
|
||||||
|
#include "td/telegram/ConfigShared.h"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/logevent/LogEvent.h"
|
#include "td/telegram/logevent/LogEvent.h"
|
||||||
#include "td/telegram/StateManager.h"
|
#include "td/telegram/StateManager.h"
|
||||||
@ -213,9 +214,13 @@ void NetStatsManager::start_up() {
|
|||||||
auto since_str = G()->td_db()->get_binlog_pmc()->get("net_stats_since");
|
auto since_str = G()->td_db()->get_binlog_pmc()->get("net_stats_since");
|
||||||
if (!since_str.empty()) {
|
if (!since_str.empty()) {
|
||||||
auto since = to_integer<int32>(since_str);
|
auto since = to_integer<int32>(since_str);
|
||||||
|
auto authorization_date = G()->shared_config().get_option_integer("authorization_date");
|
||||||
if (unix_time < since) {
|
if (unix_time < since) {
|
||||||
since_total_ = unix_time;
|
since_total_ = unix_time;
|
||||||
G()->td_db()->get_binlog_pmc()->set("net_stats_since", to_string(since_total_));
|
G()->td_db()->get_binlog_pmc()->set("net_stats_since", to_string(since_total_));
|
||||||
|
} else if (since < authorization_date - 3600) {
|
||||||
|
since_total_ = authorization_date;
|
||||||
|
G()->td_db()->get_binlog_pmc()->set("net_stats_since", to_string(since_total_));
|
||||||
} else {
|
} else {
|
||||||
since_total_ = since;
|
since_total_ = since;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user