From 3c44e14386967006559fa1de16439826fb64a8fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sun, 6 Aug 2023 17:06:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98=E7=AD=96=E7=95=A5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=A2=84=E7=83=AD=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=88=E9=BB=98=E8=AE=A420=E5=88=86?= =?UTF-8?q?=E9=92=9F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/servers/components/cache/createPopup.go | 3 +++ .../actions/default/servers/components/cache/policy.go | 8 +++++++- .../actions/default/servers/components/cache/update.go | 4 +++- .../@default/servers/components/cache/createPopup.html | 7 +++++++ web/views/@default/servers/components/cache/policy.html | 4 ++++ web/views/@default/servers/components/cache/update.html | 7 +++++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/internal/web/actions/default/servers/components/cache/createPopup.go b/internal/web/actions/default/servers/components/cache/createPopup.go index ba9bf7a6..4e9c027f 100644 --- a/internal/web/actions/default/servers/components/cache/createPopup.go +++ b/internal/web/actions/default/servers/components/cache/createPopup.go @@ -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, diff --git a/internal/web/actions/default/servers/components/cache/policy.go b/internal/web/actions/default/servers/components/cache/policy.go index 60cc0f19..2f19faf6 100644 --- a/internal/web/actions/default/servers/components/cache/policy.go +++ b/internal/web/actions/default/servers/components/cache/policy.go @@ -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, diff --git a/internal/web/actions/default/servers/components/cache/update.go b/internal/web/actions/default/servers/components/cache/update.go index 9a3a641c..c8d97084 100644 --- a/internal/web/actions/default/servers/components/cache/update.go +++ b/internal/web/actions/default/servers/components/cache/update.go @@ -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) diff --git a/web/views/@default/servers/components/cache/createPopup.html b/web/views/@default/servers/components/cache/createPopup.html index ee43428b..a6486b96 100644 --- a/web/views/@default/servers/components/cache/createPopup.html +++ b/web/views/@default/servers/components/cache/createPopup.html @@ -85,6 +85,13 @@

选中后,在压缩设置开启的情况下,在缓存源站内容的同时,也会同步写入压缩缓存;不选中,表示在源站内容缓存后,下一次调用才会缓存压缩内容,防止同一时间内硬盘IO负载过高。

+ + + 预热超时时间 + + +

预热读取源站的超时时间,默认20分钟。

+ 描述 diff --git a/web/views/@default/servers/components/cache/policy.html b/web/views/@default/servers/components/cache/policy.html index f22aaf5b..6a325790 100644 --- a/web/views/@default/servers/components/cache/policy.html +++ b/web/views/@default/servers/components/cache/policy.html @@ -83,6 +83,10 @@ N + + 预热超时时间 + {{fetchTimeoutString}}使用默认 + 描述 diff --git a/web/views/@default/servers/components/cache/update.html b/web/views/@default/servers/components/cache/update.html index b5dd68ae..47a6c8b6 100644 --- a/web/views/@default/servers/components/cache/update.html +++ b/web/views/@default/servers/components/cache/update.html @@ -92,6 +92,13 @@

选中后,在压缩设置开启的情况下,在缓存源站内容的同时,也会同步写入压缩缓存;不选中,表示在源站内容缓存后,下一次调用才会缓存压缩内容,防止同一时间内硬盘IO负载过高。

+ + + 预热超时时间 + + +

预热读取源站的超时时间,默认20分钟。

+ 描述