Skip to content

Commit

Permalink
Detect recursive use by looking for repeated component connections (#156
Browse files Browse the repository at this point in the history
)
  • Loading branch information
krzysztofreczek authored Sep 6, 2024
1 parent 7d69da8 commit 165d0d1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/scraper/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,12 @@ func (s *scraper) scrapeStruct(
}

vID := componentID(v)
if c, ok := s.typeCounters[vID]; ok && c > maxRecursiveScrapes {
vUsageKey := fmt.Sprintf("%s-%s", parentID, vID)
if c, ok := s.typeCounters[vUsageKey]; ok && c > maxRecursiveScrapes {
s.debug(v, "struct is being used recursively, skipping")
return
} else {
s.typeCounters[vID]++
s.typeCounters[vUsageKey]++
}

var c model.Component
Expand Down

0 comments on commit 165d0d1

Please sign in to comment.