mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 18:10:26 +08:00
优化代码
This commit is contained in:
@@ -77,13 +77,13 @@ func (this *BandwidthStatManager) Loop() error {
|
|||||||
for key, stat := range this.m {
|
for key, stat := range this.m {
|
||||||
if stat.Day < day || stat.TimeAt < currentTime {
|
if stat.Day < day || stat.TimeAt < currentTime {
|
||||||
pbStats = append(pbStats, &pb.ServerBandwidthStat{
|
pbStats = append(pbStats, &pb.ServerBandwidthStat{
|
||||||
Id: 0,
|
Id: 0,
|
||||||
UserId: stat.UserId,
|
UserId: stat.UserId,
|
||||||
ServerId: stat.ServerId,
|
ServerId: stat.ServerId,
|
||||||
Day: stat.Day,
|
Day: stat.Day,
|
||||||
TimeAt: stat.TimeAt,
|
TimeAt: stat.TimeAt,
|
||||||
Bytes: stat.MaxBytes / bandwidthTimestampDelim,
|
Bytes: stat.MaxBytes / bandwidthTimestampDelim,
|
||||||
RegionId: regionId,
|
NodeRegionId: regionId,
|
||||||
})
|
})
|
||||||
delete(this.m, key)
|
delete(this.m, key)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ func (this *TrafficStatManager) Upload() error {
|
|||||||
|
|
||||||
pbServerStats = append(pbServerStats, &pb.ServerDailyStat{
|
pbServerStats = append(pbServerStats, &pb.ServerDailyStat{
|
||||||
ServerId: serverId,
|
ServerId: serverId,
|
||||||
RegionId: config.RegionId,
|
NodeRegionId: config.RegionId,
|
||||||
Bytes: item.Bytes,
|
Bytes: item.Bytes,
|
||||||
CachedBytes: item.CachedBytes,
|
CachedBytes: item.CachedBytes,
|
||||||
CountRequests: item.CountRequests,
|
CountRequests: item.CountRequests,
|
||||||
|
|||||||
Reference in New Issue
Block a user