读取单个服务配置
(serverId int64)
| 435 | |
| 436 | // 读取单个服务配置 |
| 437 | func (this *Node) syncServerConfig(serverId int64) error { |
| 438 | rpcClient, err := rpc.SharedRPC() |
| 439 | if err != nil { |
| 440 | return err |
| 441 | } |
| 442 | resp, err := rpcClient.ServerRPC.ComposeServerConfig(rpcClient.Context(), &pb.ComposeServerConfigRequest{ServerId: serverId}) |
| 443 | if err != nil { |
| 444 | return err |
| 445 | } |
| 446 | |
| 447 | this.locker.Lock() |
| 448 | defer this.locker.Unlock() |
| 449 | if len(resp.ServerConfigJSON) == 0 { |
| 450 | this.updatingServerMap[serverId] = nil |
| 451 | } else { |
| 452 | var config = &serverconfigs.ServerConfig{} |
| 453 | err = json.Unmarshal(resp.ServerConfigJSON, config) |
| 454 | if err != nil { |
| 455 | return err |
| 456 | } |
| 457 | this.updatingServerMap[serverId] = config |
| 458 | } |
| 459 | return nil |
| 460 | } |
| 461 | |
| 462 | // 同步某个用户下的所有服务配置 |
| 463 | func (this *Node) syncUserServersConfig(userId int64) error { |
no test coverage detected