mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-23 18:00:27 +08:00
缓存策略增加预热超时时间设置(默认20分钟)
This commit is contained in:
@@ -21,6 +21,7 @@ func (this *CreatePopupAction) Init() {
|
||||
|
||||
func (this *CreatePopupAction) RunGet(params struct{}) {
|
||||
this.Data["types"] = serverconfigs.AllCachePolicyStorageTypes
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
@@ -36,6 +37,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
|
||||
CapacityJSON []byte
|
||||
MaxSizeJSON []byte
|
||||
FetchTimeoutJSON []byte
|
||||
SyncCompressionCache bool
|
||||
|
||||
Description string
|
||||
@@ -97,6 +99,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
Description: params.Description,
|
||||
CapacityJSON: params.CapacityJSON,
|
||||
MaxSizeJSON: params.MaxSizeJSON,
|
||||
FetchTimeoutJSON: params.FetchTimeoutJSON,
|
||||
Type: params.Type,
|
||||
OptionsJSON: optionsJSON,
|
||||
SyncCompressionCache: params.SyncCompressionCache,
|
||||
|
||||
@@ -26,6 +26,12 @@ func (this *PolicyAction) RunGet(params struct {
|
||||
}
|
||||
this.Data["cachePolicy"] = cachePolicy
|
||||
|
||||
// 预热超时时间
|
||||
this.Data["fetchTimeoutString"] = ""
|
||||
if cachePolicy.FetchTimeout != nil && cachePolicy.FetchTimeout.Count > 0 {
|
||||
this.Data["fetchTimeoutString"] = cachePolicy.FetchTimeout.Description()
|
||||
}
|
||||
|
||||
this.Data["typeName"] = serverconfigs.FindCachePolicyStorageName(cachePolicy.Type)
|
||||
|
||||
// 正在使用此策略的集群
|
||||
@@ -34,7 +40,7 @@ func (this *PolicyAction) RunGet(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
clusterMaps := []maps.Map{}
|
||||
var clusterMaps = []maps.Map{}
|
||||
for _, cluster := range clustersResp.NodeClusters {
|
||||
clusterMaps = append(clusterMaps, maps.Map{
|
||||
"id": cluster.Id,
|
||||
|
||||
@@ -61,6 +61,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
CapacityJSON []byte
|
||||
MaxSizeJSON []byte
|
||||
SyncCompressionCache bool
|
||||
FetchTimeoutJSON []byte
|
||||
|
||||
Description string
|
||||
IsOn bool
|
||||
@@ -122,7 +123,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
}
|
||||
|
||||
// 校验缓存条件
|
||||
refs := []*serverconfigs.HTTPCacheRef{}
|
||||
var refs = []*serverconfigs.HTTPCacheRef{}
|
||||
if len(params.RefsJSON) > 0 {
|
||||
err = json.Unmarshal(params.RefsJSON, &refs)
|
||||
if err != nil {
|
||||
@@ -146,6 +147,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
Type: params.Type,
|
||||
OptionsJSON: optionsJSON,
|
||||
SyncCompressionCache: params.SyncCompressionCache,
|
||||
FetchTimeoutJSON: params.FetchTimeoutJSON,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
Reference in New Issue
Block a user