mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-05 01:20:25 +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,6 +1131,8 @@ 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 {
|
||||||
|
if !lists.ContainsInt64(cachePolicyIds, httpCachePolicyId) {
|
||||||
|
cachePolicyIds = append(cachePolicyIds, httpCachePolicyId)
|
||||||
cachePolicy, err := SharedHTTPCachePolicyDAO.ComposeCachePolicy(tx, httpCachePolicyId, cacheMap)
|
cachePolicy, err := SharedHTTPCachePolicyDAO.ComposeCachePolicy(tx, httpCachePolicyId, cacheMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -1136,6 +1141,7 @@ func (this *NodeDAO) ComposeNodeConfig(tx *dbs.Tx, nodeId int64, dataMap *shared
|
|||||||
config.HTTPCachePolicies = append(config.HTTPCachePolicies, cachePolicy)
|
config.HTTPCachePolicies = append(config.HTTPCachePolicies, cachePolicy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 时区
|
// 时区
|
||||||
if len(config.TimeZone) == 0 {
|
if len(config.TimeZone) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user