限制节点自动升级时的速度和并发数

This commit is contained in:
刘祥超
2022-06-25 20:36:31 +08:00
parent 6002cc96d9
commit 4bda78aa8c
5 changed files with 129 additions and 6 deletions

View File

@@ -1602,12 +1602,12 @@ func (this *NodeService) UpdateNodeUp(ctx context.Context, req *pb.UpdateNodeUpR
// DownloadNodeInstallationFile 下载最新边缘节点安装文件
func (this *NodeService) DownloadNodeInstallationFile(ctx context.Context, req *pb.DownloadNodeInstallationFileRequest) (*pb.DownloadNodeInstallationFileResponse, error) {
_, err := this.ValidateNode(ctx)
nodeId, err := this.ValidateNode(ctx)
if err != nil {
return nil, err
}
file := installers.SharedDeployManager.FindNodeFile(req.Os, req.Arch)
var file = installers.SharedDeployManager.FindNodeFile(req.Os, req.Arch)
if file == nil {
return &pb.DownloadNodeInstallationFileResponse{}, nil
}
@@ -1622,6 +1622,9 @@ func (this *NodeService) DownloadNodeInstallationFile(ctx context.Context, req *
return nil, err
}
// 增加下载速度监控
installers.SharedUpgradeLimiter.UpdateNodeBytes(nodeconfigs.NodeRoleNode, nodeId, int64(len(data)))
return &pb.DownloadNodeInstallationFileResponse{
Sum: sum,
Offset: offset,