mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-04 16:00:24 +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.HTTPCCPolicies = map[int64]*nodeconfigs.HTTPCCPolicy{}
|
||||||
config.HTTP3Policies = map[int64]*nodeconfigs.HTTP3Policy{}
|
config.HTTP3Policies = map[int64]*nodeconfigs.HTTP3Policy{}
|
||||||
config.HTTPPagesPolicies = map[int64]*nodeconfigs.HTTPPagesPolicy{}
|
config.HTTPPagesPolicies = map[int64]*nodeconfigs.HTTPPagesPolicy{}
|
||||||
|
|
||||||
|
var cachePolicyIds = []int64{}
|
||||||
|
|
||||||
var allowIPMaps = map[string]bool{}
|
var allowIPMaps = map[string]bool{}
|
||||||
for _, clusterId := range clusterIds {
|
for _, clusterId := range clusterIds {
|
||||||
nodeCluster, err := SharedNodeClusterDAO.FindClusterBasicInfo(tx, clusterId, cacheMap)
|
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)
|
var httpCachePolicyId = int64(nodeCluster.CachePolicyId)
|
||||||
if httpCachePolicyId > 0 {
|
if httpCachePolicyId > 0 {
|
||||||
cachePolicy, err := SharedHTTPCachePolicyDAO.ComposeCachePolicy(tx, httpCachePolicyId, cacheMap)
|
if !lists.ContainsInt64(cachePolicyIds, httpCachePolicyId) {
|
||||||
if err != nil {
|
cachePolicyIds = append(cachePolicyIds, httpCachePolicyId)
|
||||||
return nil, err
|
cachePolicy, err := SharedHTTPCachePolicyDAO.ComposeCachePolicy(tx, httpCachePolicyId, cacheMap)
|
||||||
}
|
if err != nil {
|
||||||
if cachePolicy != nil {
|
return nil, err
|
||||||
config.HTTPCachePolicies = append(config.HTTPCachePolicies, cachePolicy)
|
}
|
||||||
|
if cachePolicy != nil {
|
||||||
|
config.HTTPCachePolicies = append(config.HTTPCachePolicies, cachePolicy)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user