Skip to content

Commit

Permalink
Clean logging
Browse files Browse the repository at this point in the history
  • Loading branch information
krhitesh7 committed Jun 10, 2024
1 parent bf6fe29 commit 9db90a9
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pkg/cache/v3/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (cache *snapshotCache) DeleteResources(ctx context.Context, _ string, typ s
cache.mu.Lock()
defer cache.mu.Unlock()

fmt.Printf("Got DeleteResources resource %v", resourcesToDeleted)
fmt.Printf("local DeleteResources %v", resourcesToDeleted)

resourceToDelete := resourcesToDeleted[0]
resourceToDeleteParts := strings.Split(resourcesToDeleted[0], "/")
Expand All @@ -378,8 +378,6 @@ func (cache *snapshotCache) DeleteResources(ctx context.Context, _ string, typ s
portString := strings.Split(resourcesToDeleted[0], "_")[1]
claName := fmt.Sprintf("xdstp://nexus/%s/%s/%s", strings.Split(resource.EndpointType, "/")[1], serviceName, portString)

cache.log.Infof("DeleteResources claName=%s", claName)

for node_, snapshot := range cache.snapshots {

Check warning on line 381 in pkg/cache/v3/simple.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: don't use underscores in Go names; range var node_ should be node (revive)

Check warning on line 381 in pkg/cache/v3/simple.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: don't use underscores in Go names; range var node_ should be node (revive)
currentResources := snapshot.(*Snapshot).Resources[types.Endpoint]
if rsc, found := currentResources.Items[claName]; found {
Expand Down Expand Up @@ -413,8 +411,6 @@ func (cache *snapshotCache) DeleteResources(ctx context.Context, _ string, typ s

// Respond deltas
if info, ok := cache.status[node_]; ok {
fmt.Println("Now responding deltas!")

info.mu.Lock()
_ = cache.respondDeltaWatches(ctx, info, snapshot)
info.mu.Unlock()
Expand All @@ -424,17 +420,17 @@ func (cache *snapshotCache) DeleteResources(ctx context.Context, _ string, typ s
return nil
}

func (cache *snapshotCache) DrainResources(ctx context.Context, _ string, typ string, resourcesToDeleted []string) error {
func (cache *snapshotCache) DrainResources(ctx context.Context, _ string, typ string, resourcesToDrain []string) error {

Check failure on line 423 in pkg/cache/v3/simple.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)

Check failure on line 423 in pkg/cache/v3/simple.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
cache.mu.Lock()
defer cache.mu.Unlock()

fmt.Printf("Got DeleteResources resource %v", resourcesToDeleted)
fmt.Printf("local DrainResources resource %v", resourcesToDrain)

resourceToDelete := resourcesToDeleted[0]
resourceToDeleteParts := strings.Split(resourcesToDeleted[0], "/")
resourceToDelete := resourcesToDrain[0]
resourceToDeleteParts := strings.Split(resourcesToDrain[0], "/")
serviceName := resourceToDeleteParts[4]
zone := resourceToDeleteParts[5]
portString := strings.Split(resourcesToDeleted[0], "_")[1]
portString := strings.Split(resourcesToDrain[0], "_")[1]
claName := fmt.Sprintf("xdstp://nexus/%s/%s/%s", strings.Split(resource.EndpointType, "/")[1], serviceName, portString)

cache.log.Infof("DeleteResources claName=%s", claName)
Expand Down Expand Up @@ -479,8 +475,6 @@ func (cache *snapshotCache) DrainResources(ctx context.Context, _ string, typ st

// Respond deltas
if info, ok := cache.status[node_]; ok {
fmt.Println("Now responding deltas!")

info.mu.Lock()
_ = cache.respondDeltaWatches(ctx, info, snapshot)
info.mu.Unlock()
Expand Down

0 comments on commit 9db90a9

Please sign in to comment.