Skip to content

Commit

Permalink
Trigger target update if client list changes
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Robinson <[email protected]>
  • Loading branch information
henryr committed Feb 3, 2025
1 parent 43f0574 commit 24ec168
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/vt/vtgateproxy/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ func (b *JSONGateResolverBuilder) start() error {

go func() {
var parseErr error
lastClientIndex := -1
for range b.ticker.C {
checkFileStat, err := os.Stat(b.jsonPath)
if err != nil {
Expand All @@ -213,10 +214,13 @@ func (b *JSONGateResolverBuilder) start() error {
continue
}
parseErr = nil
if !contentsChanged {
curClientIndex := getClientIndex()
clientsChanged := (lastClientIndex == curClientIndex)
if !contentsChanged && !clientsChanged {
parseCount.Add("unchanged", 1)
continue
}
lastClientIndex = curClientIndex
parseCount.Add("changed", 1)

var wg sync.WaitGroup
Expand Down

0 comments on commit 24ec168

Please sign in to comment.