mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-23 23:10:26 +08:00
当服务配置变化时创建单个服务通知任务
This commit is contained in:
@@ -39,6 +39,7 @@ func (this *NodeTaskService) FindNodeTasks(ctx context.Context, req *pb.FindNode
|
||||
Type: task.Type,
|
||||
Version: int64(task.Version),
|
||||
IsPrimary: primaryNodeId == nodeId,
|
||||
ServerId: int64(task.ServerId),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -137,6 +138,7 @@ func (this *NodeTaskService) FindNodeClusterTasks(ctx context.Context, req *pb.F
|
||||
IsOk: task.IsOk == 1,
|
||||
Error: task.Error,
|
||||
UpdatedAt: int64(task.UpdatedAt),
|
||||
ServerId: int64(task.ServerId),
|
||||
Node: &pb.Node{
|
||||
Id: int64(task.NodeId),
|
||||
Name: nodeName,
|
||||
@@ -261,6 +263,7 @@ func (this *NodeTaskService) FindNotifyingNodeTasks(ctx context.Context, req *pb
|
||||
Error: task.Error,
|
||||
UpdatedAt: int64(task.UpdatedAt),
|
||||
Node: &pb.Node{Id: int64(task.NodeId)},
|
||||
ServerId: int64(task.ServerId),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1924,3 +1924,29 @@ func (this *ServerService) FindServerUserPlan(ctx context.Context, req *pb.FindS
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ComposeServerConfig 获取服务配置
|
||||
func (this *ServerService) ComposeServerConfig(ctx context.Context, req *pb.ComposeServerConfigRequest) (*pb.ComposeServerConfigResponse, error) {
|
||||
_, err := this.ValidateNode(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
serverConfig, err := models.SharedServerDAO.ComposeServerConfigWithServerId(tx, req.ServerId, true)
|
||||
if err != nil {
|
||||
if err == models.ErrNotFound {
|
||||
return &pb.ComposeServerConfigResponse{ServerConfigJSON: nil}, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if serverConfig == nil {
|
||||
return &pb.ComposeServerConfigResponse{ServerConfigJSON: nil}, nil
|
||||
}
|
||||
|
||||
configJSON, err := json.Marshal(serverConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.ComposeServerConfigResponse{ServerConfigJSON: configJSON}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user