自动更新缓存任务执行状况/优化缓存相关文字提示

This commit is contained in:
GoEdgeLab
2022-06-15 15:47:43 +08:00
parent e0920c3b8a
commit 19ea8dc354
13 changed files with 85 additions and 47 deletions

View File

@@ -16,7 +16,7 @@ func init() {
GetPost("", new(IndexAction)).
GetPost("/fetch", new(FetchAction)).
Get("/tasks", new(TasksAction)).
Get("/task", new(TaskAction)).
GetPost("/task", new(TaskAction)).
Post("/deleteTask", new(DeleteTaskAction)).
Post("/resetTask", new(ResetTaskAction)).
EndAll()

View File

@@ -29,14 +29,32 @@ func (this *TaskAction) RunGet(params struct {
return
}
taskResp, err := this.RPC().HTTPCacheTaskRPC().FindEnabledHTTPCacheTask(this.AdminContext(), &pb.FindEnabledHTTPCacheTaskRequest{HttpCacheTaskId: params.TaskId})
if !this.readTask(params.TaskId) {
return
}
this.Show()
}
func (this *TaskAction) RunPost(params struct {
TaskId int64
}) {
if !this.readTask(params.TaskId) {
return
}
this.Success()
}
// 读取任务信息
func (this *TaskAction) readTask(taskId int64) (ok bool) {
taskResp, err := this.RPC().HTTPCacheTaskRPC().FindEnabledHTTPCacheTask(this.AdminContext(), &pb.FindEnabledHTTPCacheTaskRequest{HttpCacheTaskId: taskId})
if err != nil {
this.ErrorPage(err)
return
}
var task = taskResp.HttpCacheTask
if task == nil {
this.NotFound("HTTPCacheTask", params.TaskId)
this.NotFound("HTTPCacheTask", taskId)
return
}
@@ -101,5 +119,6 @@ func (this *TaskAction) RunGet(params struct {
"user": userMap,
}
this.Show()
ok = true
return
}