make report slow.
This commit is contained in:
parent
0f0d7965c3
commit
f12ecefe14
@ -48,7 +48,9 @@ void SystemUsage::start() {
|
||||
auto transmitGigabyte = static_cast<float>(back.transmitBytes - front.transmitBytes) / gigabyte;
|
||||
auto speed = (receiveGigabyte + transmitGigabyte) / duration.count() * SpeedInterval.count();
|
||||
LOG(info) << "network speed: " << std::fixed << std::setprecision(2) << speed << "GB/h";
|
||||
if (speed >= 1.f) { // 一个小时1GB的流量
|
||||
static system_clock::time_point lastNotify;
|
||||
auto now = system_clock::now();
|
||||
if ((speed >= 1.f) && (duration_cast<minutes>(now - lastNotify) > minutes(10))) { // 一个小时1GB的流量
|
||||
std::ostringstream oss;
|
||||
oss << "当前服务器流量存在异常, " << DateTime::toString(front.time) << " - "
|
||||
<< DateTime::toString(back.time) << ": " << std::endl;
|
||||
@ -58,6 +60,7 @@ void SystemUsage::start() {
|
||||
auto manager = Amass::Singleton<ServiceManager>::instance();
|
||||
if (manager) manager->sendMessage(NotifyServerChan, oss.str());
|
||||
LOG(warning) << oss.str();
|
||||
lastNotify = now;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user