Skip to content

Commit

Permalink
Delay the self-check slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Nov 17, 2021
1 parent 938a43c commit 3027409
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compat/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ func prep() error {
func start() error {
selfcheckTask = module.NewTask("compatibility self-check", selfcheckTaskFunc).
Repeat(1 * time.Minute).
StartASAP()
MaxDelay(selfcheckTaskRetryAfter).
Schedule(time.Now().Add(selfcheckTaskRetryAfter))

return module.RegisterEventHook(
netenv.ModuleName,
netenv.NetworkChangedEvent,
"trigger compat self-check",
func(_ context.Context, _ interface{}) error {
selfcheckTask.StartASAP()
selfcheckTask.Schedule(time.Now().Add(selfcheckTaskRetryAfter))
return nil
},
)
Expand Down

0 comments on commit 3027409

Please sign in to comment.