Skip to content

Commit

Permalink
only stat once per second
Browse files Browse the repository at this point in the history
  • Loading branch information
demmer committed Apr 12, 2024
1 parent 2f5ab37 commit 90b7e0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go/vt/vtgateproxy/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (b *JSONGateResolverBuilder) start() error {
log.Infof("loaded %d targets, pool types %v, affinity groups %v", len(b.targets), poolTypes, affinityTypes)

// Start a config watcher
b.ticker = time.NewTicker(100 * time.Millisecond)
b.ticker = time.NewTicker(1 * time.Second)
fileStat, err := os.Stat(b.jsonPath)
if err != nil {
return err
Expand All @@ -164,7 +164,7 @@ func (b *JSONGateResolverBuilder) start() error {
log.Errorf("Error stat'ing config %v\n", err)
continue
}
isUnchanged := checkFileStat.Size() == fileStat.Size() || checkFileStat.ModTime() == fileStat.ModTime()
isUnchanged := checkFileStat.Size() == fileStat.Size() && checkFileStat.ModTime() == fileStat.ModTime()
if isUnchanged {
// no change
continue
Expand Down

0 comments on commit 90b7e0f

Please sign in to comment.