mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 06:40:26 +08:00
单个节点所在多个集群共用一个缓存策略时只加载其中一个
This commit is contained in:
@@ -1089,6 +1089,9 @@ func (this *NodeDAO) ComposeNodeConfig(tx *dbs.Tx, nodeId int64, dataMap *shared
|
||||
config.HTTPCCPolicies = map[int64]*nodeconfigs.HTTPCCPolicy{}
|
||||
config.HTTP3Policies = map[int64]*nodeconfigs.HTTP3Policy{}
|
||||
config.HTTPPagesPolicies = map[int64]*nodeconfigs.HTTPPagesPolicy{}
|
||||
|
||||
var cachePolicyIds = []int64{}
|
||||
|
||||
var allowIPMaps = map[string]bool{}
|
||||
for _, clusterId := range clusterIds {
|
||||
nodeCluster, err := SharedNodeClusterDAO.FindClusterBasicInfo(tx, clusterId, cacheMap)
|
||||
@@ -1128,12 +1131,15 @@ func (this *NodeDAO) ComposeNodeConfig(tx *dbs.Tx, nodeId int64, dataMap *shared
|
||||
// 缓存策略
|
||||
var httpCachePolicyId = int64(nodeCluster.CachePolicyId)
|
||||
if httpCachePolicyId > 0 {
|
||||
cachePolicy, err := SharedHTTPCachePolicyDAO.ComposeCachePolicy(tx, httpCachePolicyId, cacheMap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if cachePolicy != nil {
|
||||
config.HTTPCachePolicies = append(config.HTTPCachePolicies, cachePolicy)
|
||||
if !lists.ContainsInt64(cachePolicyIds, httpCachePolicyId) {
|
||||
cachePolicyIds = append(cachePolicyIds, httpCachePolicyId)
|
||||
cachePolicy, err := SharedHTTPCachePolicyDAO.ComposeCachePolicy(tx, httpCachePolicyId, cacheMap)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if cachePolicy != nil {
|
||||
config.HTTPCachePolicies = append(config.HTTPCachePolicies, cachePolicy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user