1
0
mirror of https://github.com/astaxie/beego.git synced 2025-08-02 02:35:30 +00:00

Adapter: toolbox module

This commit is contained in:
Ming Deng
2020-09-03 21:34:46 +08:00
parent cbd51616f1
commit 3530457ff9
8 changed files with 572 additions and 3 deletions

View File

@@ -83,7 +83,7 @@ type Schedule struct {
}
// TaskFunc task func type
type TaskFunc func() error
type TaskFunc func(ctx context.Context) error
// Tasker task interface
type Tasker interface {
@@ -148,8 +148,8 @@ func (t *Task) GetStatus(context.Context) string {
}
// Run run all tasks
func (t *Task) Run(context.Context) error {
err := t.DoFunc()
func (t *Task) Run(ctx context.Context) error {
err := t.DoFunc(ctx)
if err != nil {
index := t.errCnt % t.ErrLimit
t.Errlist[index] = &taskerr{t: t.Next, errinfo: err.Error()}