Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion internal/xds/cache/snapshotcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ func (s *snapshotCache) GenerateNewSnapshot(irKey string, resources types.XdsRes
}
xdsSnapshotCreateTotal.WithSuccess().Increment()

s.lastSnapshot[irKey] = snapshot
// Delete snapshot from cache if resources are nil
if resources == nil {
delete(s.lastSnapshot, irKey)
} else {
// Update snapshot in cache
s.lastSnapshot[irKey] = snapshot
}

for _, node := range s.getNodeIDs(irKey) {
s.log.Debugf("Generating a snapshot with Node %s", node)
Expand Down
2 changes: 1 addition & 1 deletion internal/xds/runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func TestRunner(t *testing.T) {
xdsIR.Delete("test")
require.Eventually(t, func() bool {
// Wait for the IR to be empty after deletion
return len(xdsIR.LoadAll()) == 0
return !r.cache.SnapshotHasIrKey("test") && len(xdsIR.LoadAll()) == 0
}, time.Second*5, time.Millisecond*50)
}

Expand Down
Loading