优化定时器的表述

This commit is contained in:
Yun
2023-12-27 17:19:52 +08:00
parent 1beafa934c
commit 43d2798b41
3 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ func main() {
func worker() {
client := getRedis()
w := timerx.InitOnce(context.Background(), client, &Worker{})
w := timerx.InitOnce(context.Background(), client,"test", &Worker{})
w.Add("test", "test", 1*time.Second, map[string]interface{}{
"test": "test",
})
@@ -52,7 +52,7 @@ func worker() {
type Worker struct{}
func (w *Worker) Worker(uniqueKey string, jobType string, data interface{}) (timerx.WorkerCode, time.Duration) {
func (w *Worker) Worker(jobType string,uniqueKey string, data interface{}) (timerx.WorkerCode, time.Duration) {
fmt.Println("执行时间:", time.Now().Format("2006-01-02 15:04:05"))
fmt.Println(uniqueKey, jobType)
fmt.Println(data)