-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: 新增输出Task信息与Counter信息的go原生HandlerFunc * fix: 修复CronTask对RunCounter统计逻辑BUG * refactor: 重构startCronTask实现 * About HttpOutput: - CounterOutputHttpHandler: 用于输出当前时刻所有Task的Counter信息 - TaskOutputHttpHandler: 用于输出所有Task的配置信息 - Code Example Link: https://github.com/devfeel/dotweb-start/blob/master/server/router.go#L20 * How to use: ~~~ go server.RegisterHandlerFunc(dotweb.RouteMethod_GET, "/task/counter", global.DotTask.CounterOutputHttpHandler) ~~~ * 2019-11-10 09:00
- Loading branch information
Showing
4 changed files
with
79 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package task | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
) | ||
|
||
// CounterOutputHttpHandler Http Handler for output counter info | ||
func (service *TaskService) CounterOutputHttpHandler(w http.ResponseWriter, r *http.Request) { | ||
str, _ := json.Marshal(service.GetAllTaskCountInfo()) | ||
w.Write([]byte(str)) | ||
} | ||
|
||
// TaskOutputHttpHandler Http Handler for output task info | ||
func (service *TaskService) TaskOutputHttpHandler(w http.ResponseWriter, r *http.Request) { | ||
str, _ := json.Marshal(service.GetAllTasks()) | ||
w.Write([]byte(str)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters