|
12345678910111213141516171819202122232425262728293031 |
- package cron
-
- import (
- "github.com/zeromicro/go-zero/zrpc"
- "gitlink.org.cn/jcce-pcm/pcm-coordinator/api/internal/svc"
- "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/constants"
- "gitlink.org.cn/jcce-pcm/pcm-coordinator/pkg/models"
- "gitlink.org.cn/jcce-pcm/pcm-participant-kubernetes/kubernetesclient"
- )
-
- func SyncParticipantRpc(svc *svc.ServiceContext) {
- // 查询出所有p端信息
- var participants []*models.ScParticipantPhyInfo
- tx := svc.DbEngin.Find(&participants)
- if tx.Error != nil {
-
- }
- for _, participant := range participants {
- // 初始化p端rpc客户端
- if len(participant.RpcAddress) != 0 && svc.K8sRpc[participant.Id] == nil {
- switch participant.Type {
- case constants.CLOUD:
- svc.K8sRpc[participant.Id] = kubernetesclient.NewKubernetes(zrpc.MustNewClient(zrpc.RpcClientConf{
- Endpoints: []string{participant.RpcAddress},
- NonBlock: true,
- }))
- }
- }
- }
-
- }
|