diff --git a/internal/logic/server/getServerConfigLogic.go b/internal/logic/server/getServerConfigLogic.go index 2b7ea3bf..85b74d84 100644 --- a/internal/logic/server/getServerConfigLogic.go +++ b/internal/logic/server/getServerConfigLogic.go @@ -69,12 +69,16 @@ func (l *GetServerConfigLogic) GetServerConfig(req *types.GetServerConfigRequest } var cfg map[string]interface{} for _, protocol := range protocols { - if protocol.Type == protocolRequest { + if protocol.Enable && protocol.Type == protocolRequest { cfg = l.compatible(protocol) break } } + if cfg == nil { + return nil, fmt.Errorf("protocol %s not found or disabled", req.Protocol) + } + resp = &types.GetServerConfigResponse{ Basic: types.ServerBasic{ PullInterval: l.svcCtx.Config.Node.NodePullInterval, diff --git a/internal/logic/server/queryServerProtocolConfigLogic.go b/internal/logic/server/queryServerProtocolConfigLogic.go index 4521c556..198d8246 100644 --- a/internal/logic/server/queryServerProtocolConfigLogic.go +++ b/internal/logic/server/queryServerProtocolConfigLogic.go @@ -41,6 +41,15 @@ func (l *QueryServerProtocolConfigLogic) QueryServerProtocolConfig(req *types.Qu } tool.DeepCopy(&protocols, dst) + // only return enabled protocols for node distribution + var enabledProtocols []types.Protocol + for _, p := range protocols { + if p.Enable { + enabledProtocols = append(enabledProtocols, p) + } + } + protocols = enabledProtocols + // filter by req.Protocols if len(req.Protocols) > 0 { diff --git a/internal/model/node/model.go b/internal/model/node/model.go index ddfa736d..ccad51df 100644 --- a/internal/model/node/model.go +++ b/internal/model/node/model.go @@ -128,7 +128,7 @@ func (m *customServerModel) ClearNodeCache(ctx context.Context, params *FilterNo return err } if len(keys) > 0 { - cacheKeys = append(keys, keys...) + cacheKeys = append(cacheKeys, keys...) } cursor = newCursor if cursor == 0 {