Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ func (f *NamespaceFactory) Action(ctx context.Context, clusterID, projectIDOrCod
logging.Error("get project from db failed, err: %s", err.Error())
return nil, err
}
// 若缓存信息校验失败,则绕过缓存重新拉取一次,防止集群状态刚切换时产生误判
if cluster.GetProjectID() != project.ProjectID && !cluster.GetIsShared() {
if freshCluster, err := clustermanager.GetCluster(ctx, clusterID, false); err == nil && freshCluster != nil {
cluster = freshCluster
}
}

if cluster.GetProjectID() != project.ProjectID {
if cluster.GetIsShared() {
return shared.NewSharedNamespaceAction(f.model), nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func GetCluster(ctx context.Context, clusterID string, isCache bool) (*clusterma
logging.Error("get cluster from cluster manager failed, msg: %s", resp.GetMessage())
return nil, errors.New(resp.GetMessage())
}
_ = c.Add(fmt.Sprintf(CacheKeyClusterPrefix, clusterID), resp.GetData(), 5*time.Minute)
c.Set(fmt.Sprintf(CacheKeyClusterPrefix, clusterID), resp.GetData(), 5*time.Minute)
return resp.GetData(), nil
}

Expand Down
Loading