Skip to content

Commit

Permalink
Fix for delayedResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
krhitesh7 committed Sep 27, 2024
1 parent 4b7e052 commit 28c35a8
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions pkg/cache/v3/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,17 +929,25 @@ func (cache *snapshotCache) CreateDeltaWatch(request *DeltaRequest, state stream
// - we attempted to issue a response, but the caller is already up to date
delayedResponse := !exists
if exists {
err := snapshot.ConstructVersionMap()
if err != nil {
cache.log.Errorf("failed to compute version for snapshot resources inline: %s", err)
}
// We don't need to respond. We're handling this in a better way in ads.
response, err := cache.respondDelta(context.Background(), snapshot, request, value, state)
if err != nil {
cache.log.Errorf("failed to respond with delta response: %s", err)
}
hasResources := false
resources := snapshot.GetResources(request.GetTypeUrl())
hasResources = resources != nil && len(resources) > 0
fmt.Printf(fmt.Sprintf("hasResources for %s hasResources=%v\n", request.GetTypeUrl(), hasResources))
if hasResources {
err := snapshot.ConstructVersionMap()
if err != nil {
cache.log.Errorf("failed to compute version for snapshot resources inline: %s", err)
}

delayedResponse = response == nil
response, err := cache.respondDelta(context.Background(), snapshot, request, value, state)
if err != nil {
cache.log.Errorf("failed to respond with delta response: %s", err)
}

delayedResponse = response == nil
} else {
delayedResponse = true
}
}

if delayedResponse {
Expand Down

0 comments on commit 28c35a8

Please sign in to comment.