1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-01 15:37:31 +00:00

Fixed errors in obtaining object relationships

Issue: https://github.com/harvester/harvester/issues/1857
This commit is contained in:
michelia
2022-01-26 19:31:03 +08:00
parent e7119828b8
commit 42c575a009
2 changed files with 8 additions and 8 deletions

View File

@@ -80,11 +80,10 @@ func (s *SummaryCache) OnInboundRelationshipChange(ctx context.Context, schema *
s.cbs[id] = cb
go func() {
defer close(ret)
for rel := range cb {
if rel.Kind == kind &&
rel.APIVersion == apiVersion &&
rel.Namespace == namespace {
(namespace == "" || namespace == rel.Namespace) {
ret <- rel
}
}
@@ -95,10 +94,11 @@ func (s *SummaryCache) OnInboundRelationshipChange(ctx context.Context, schema *
s.Lock()
defer s.Unlock()
close(cb)
defer close(ret)
delete(s.cbs, id)
}()
return cb
return ret
}
func (s *SummaryCache) SummaryAndRelationship(obj runtime.Object) (*summary.SummarizedObject, []Relationship) {