Skip to content

Commit

Permalink
add some comments
Browse files Browse the repository at this point in the history
Signed-off-by: zyguan <[email protected]>
  • Loading branch information
zyguan committed Feb 22, 2024
1 parent cf6ddc3 commit 7a0f718
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/locate/region_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ func (r *bgRunner) shutdown(wait bool) {
}
}

// run calls `f` once in background.
func (r *bgRunner) run(f func(context.Context)) {
if r.closed() {
return
Expand All @@ -562,6 +563,7 @@ func (r *bgRunner) run(f func(context.Context)) {
}()
}

// schedule calls `f` every `interval`.
func (r *bgRunner) schedule(f func(context.Context, time.Time) bool, interval time.Duration) {
if r.closed() {
return
Expand All @@ -586,6 +588,7 @@ func (r *bgRunner) schedule(f func(context.Context, time.Time) bool, interval ti
}()
}

// scheduleWithTrigger likes schedule, but also call `f` when `<-trigger`, in which case the time arg of `f` is zero.
func (r *bgRunner) scheduleWithTrigger(f func(context.Context, time.Time) bool, interval time.Duration, trigger <-chan struct{}) {
if r.closed() {
return
Expand Down

0 comments on commit 7a0f718

Please sign in to comment.