mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 14:50:25 +08:00
增加刷新、预热缓存任务管理
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
)
|
||||
|
||||
// 查找缓存策略名称并忽略错误
|
||||
// FindCachePolicyNameWithoutError 查找缓存策略名称并忽略错误
|
||||
func FindCachePolicyNameWithoutError(parent *actionutils.ParentAction, cachePolicyId int64) string {
|
||||
policy, err := FindCachePolicy(parent, cachePolicyId)
|
||||
if err != nil {
|
||||
@@ -20,7 +20,7 @@ func FindCachePolicyNameWithoutError(parent *actionutils.ParentAction, cachePoli
|
||||
return policy.Name
|
||||
}
|
||||
|
||||
// 查找缓存策略配置
|
||||
// FindCachePolicy 查找缓存策略配置
|
||||
func FindCachePolicy(parent *actionutils.ParentAction, cachePolicyId int64) (*serverconfigs.HTTPCachePolicy, error) {
|
||||
resp, err := parent.RPC().HTTPCachePolicyRPC().FindEnabledHTTPCachePolicyConfig(parent.AdminContext(), &pb.FindEnabledHTTPCachePolicyConfigRequest{HttpCachePolicyId: cachePolicyId})
|
||||
if err != nil {
|
||||
@@ -36,3 +36,20 @@ func FindCachePolicy(parent *actionutils.ParentAction, cachePolicyId int64) (*se
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// KeyFailReason Key相关失败原因
|
||||
func KeyFailReason(reasonCode string) string {
|
||||
switch reasonCode {
|
||||
case "requireKey":
|
||||
return "空的Key"
|
||||
case "requireDomain":
|
||||
return "找不到Key对应的域名"
|
||||
case "requireServer":
|
||||
return "找不到Key对应的网站服务"
|
||||
case "requireUser":
|
||||
return "该域名不属于当前用户"
|
||||
case "requireClusterId":
|
||||
return "该网站没有部署到集群"
|
||||
}
|
||||
return "未知错误"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user