mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-19 23:03:08 +00:00
fix lint errors
This commit is contained in:
11 files changed
+87
-66
No files matched your search
@@ -11,6 +11,8 @@ type PeriodicTask struct {
|
||||
Interval time.Duration
|
||||
// Execute is the task function
|
||||
Execute func() error
|
||||
// OnFailure will be called when Execute returns non-nil error
|
||||
OnError func(error)
|
||||
|
||||
access sync.Mutex
|
||||
timer *time.Timer
|
||||
@@ -30,7 +32,9 @@ func (t *PeriodicTask) checkedExecute() error {
|
||||
}
|
||||
|
||||
t.timer = time.AfterFunc(t.Interval, func() {
|
||||
t.checkedExecute()
|
||||
if err := t.checkedExecute(); err != nil && t.OnError != nil {
|
||||
t.OnError(err)
|
||||
}
|
||||
})
|
||||
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user