Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Nov 21, 2021
1 parent ad1d865 commit c663d2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions application/handler/collector/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/admpub/log"
"github.com/admpub/nging/v3/application/library/collector/exec"
"github.com/admpub/nging/v3/application/library/collector/export"
"github.com/admpub/nging/v3/application/library/common"
"github.com/admpub/nging/v3/application/library/cron"
"github.com/admpub/nging/v3/application/model"
"github.com/webx-top/com"
Expand Down Expand Up @@ -82,6 +83,7 @@ func Go(k interface{}, r *exec.Rules, f func(), ctx context.Context) (err error)
select {
case <-ctx.Done():
process.Close(k)
log.Warnf(`[collector] %v`, common.ErrContextCanceled)
return
default:
f()
Expand Down
7 changes: 4 additions & 3 deletions application/library/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ var (
// - Checker

// ErrNext 需要继续向下检查
ErrNext = errors.New("Next")
ErrConcurrentLock = errors.New("Concurrent lock has been triggered")
errInstances = map[string]error{}
ErrNext = errors.New("Next")
ErrConcurrentLock = errors.New("Concurrent lock has been triggered")
ErrContextCanceled = errors.New("Context canceled")
errInstances = map[string]error{}
)

func RegisterErr(key string, err error) {
Expand Down

0 comments on commit c663d2a

Please sign in to comment.