Skip to content

Commit

Permalink
watch only while it has watcher (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktong authored Feb 2, 2024
1 parent 353e667 commit a6cdf44
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ func (c *Config) Watch(ctx context.Context) error { //nolint:cyclop,funlen,gocog
panic("cannot watch change with nil context")
}

if hasWatcher := slices.ContainsFunc(c.providers, func(provider *provider) bool {
_, ok := provider.loader.(Watcher)

return ok
}); !hasWatcher {
return nil
}

watched := true
c.watchOnce.Do(func() {
watched = false
Expand Down

0 comments on commit a6cdf44

Please sign in to comment.