Skip to content

Commit

Permalink
xdsclient: invoke watch callback when new update matches cached one, …
Browse files Browse the repository at this point in the history
…but previous update was NACKed (1/N) (#7692)
  • Loading branch information
easwars authored Oct 7, 2024
1 parent ab5af45 commit 9afb232
Show file tree
Hide file tree
Showing 4 changed files with 482 additions and 526 deletions.
9 changes: 6 additions & 3 deletions xds/internal/xdsclient/authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,12 @@ func (a *authority) updateResourceStateAndScheduleCallbacks(rType xdsresource.Ty
state.deletionIgnored = false
a.logger.Infof("A valid update was received for resource %q of type %q after previously ignoring a deletion", name, rType.TypeName())
}
// Notify watchers only if this is a first time update or it is different
// from the one currently cached.
if state.cache == nil || !state.cache.Equal(uErr.resource) {
// Notify watchers if any of these conditions are met:
// - this is the first update for this resource
// - this update is different from the one currently cached
// - the previous update for this resource was NACKed, but the update
// before that was the same as this update.
if state.cache == nil || !state.cache.Equal(uErr.resource) || state.md.ErrState != nil {
for watcher := range state.watchers {
watcher := watcher
resource := uErr.resource
Expand Down
Loading

0 comments on commit 9afb232

Please sign in to comment.