Skip to content

Commit b15e91f

Browse files
committed
fix: defer RUnlock in AsClients
1 parent 35e2a4e commit b15e91f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/controller/registry/grpc/source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ func (s *SourceStore) Remove(key resolver.CatalogKey) error {
193193
func (s *SourceStore) AsClients(globalNamespace, localNamespace string) map[resolver.CatalogKey]client.Interface {
194194
refs := map[resolver.CatalogKey]client.Interface{}
195195
s.sourcesLock.RLock()
196+
defer s.sourcesLock.RUnlock()
196197
for key, source := range s.sources {
197198
if !(key.Namespace == globalNamespace || key.Namespace == localNamespace) {
198199
continue
@@ -202,7 +203,6 @@ func (s *SourceStore) AsClients(globalNamespace, localNamespace string) map[reso
202203
}
203204
refs[key] = client.NewClientFromConn(source.Conn)
204205
}
205-
s.sourcesLock.RUnlock()
206206

207207
// TODO : remove unhealthy
208208
return refs

0 commit comments

Comments
 (0)