Skip to content

Commit

Permalink
Merge pull request #343 from wy-lucky/main
Browse files Browse the repository at this point in the history
fix: send on close channel
  • Loading branch information
mrlihanbo authored Dec 12, 2024
2 parents eea8b07 + 6bbe8ab commit 26a5bcb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/registry/hpaaggregator/aggregation/forward/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,25 @@ func (p *PodREST) Watch(ctx context.Context, options *metainternalversion.ListOp
case event, ok := <-watcher.ResultChan():
if !ok {
lock.Lock()
defer lock.Unlock()

if !isProxyChClosed {
close(proxyCh)
isProxyChClosed = true
logger.WithValues("cluster", cluster).Info("Closed proxy watcher channel")
}
lock.Unlock()

return
}
if pod, ok := event.Object.(*corev1.Pod); ok {
clusterobject.MakePodUnique(pod, cluster)
event.Object = pod
}
proxyCh <- event

lock.Lock()
if !isProxyChClosed {
proxyCh <- event
}
lock.Unlock()
}
}
}(clusters[i].Name)
Expand Down

0 comments on commit 26a5bcb

Please sign in to comment.