make report slow.
All checks were successful
Deploy / Build (push) Successful in 4m31s
Deploy Docker Images / Build dockerfile and Server deploy (push) Successful in 18s

This commit is contained in:
luocai 2024-11-11 10:08:24 +08:00
parent 0f0d7965c3
commit f12ecefe14

View File

@ -48,7 +48,9 @@ void SystemUsage::start() {
auto transmitGigabyte = static_cast<float>(back.transmitBytes - front.transmitBytes) / gigabyte; auto transmitGigabyte = static_cast<float>(back.transmitBytes - front.transmitBytes) / gigabyte;
auto speed = (receiveGigabyte + transmitGigabyte) / duration.count() * SpeedInterval.count(); auto speed = (receiveGigabyte + transmitGigabyte) / duration.count() * SpeedInterval.count();
LOG(info) << "network speed: " << std::fixed << std::setprecision(2) << speed << "GB/h"; 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; std::ostringstream oss;
oss << "当前服务器流量存在异常, " << DateTime::toString(front.time) << " - " oss << "当前服务器流量存在异常, " << DateTime::toString(front.time) << " - "
<< DateTime::toString(back.time) << ": " << std::endl; << DateTime::toString(back.time) << ": " << std::endl;
@ -58,6 +60,7 @@ void SystemUsage::start() {
auto manager = Amass::Singleton<ServiceManager>::instance(); auto manager = Amass::Singleton<ServiceManager>::instance();
if (manager) manager->sendMessage(NotifyServerChan, oss.str()); if (manager) manager->sendMessage(NotifyServerChan, oss.str());
LOG(warning) << oss.str(); LOG(warning) << oss.str();
lastNotify = now;
} }
break; break;
} }