Skip to content

Commit

Permalink
ignore mass amount of results when picking for observation
Browse files Browse the repository at this point in the history
  • Loading branch information
amirylm committed Mar 20, 2024
1 parent 2740fc7 commit f9a7aa2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/v3/plugin/hooks/add_from_staging.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ func (hook *AddFromStagingHook) RunHook(obs *ocr2keepersv3.AutomationObservation
if err != nil {
return err
}
n := len(results)
maxResults := limit * 10
if len(results) > maxResults {
hook.logger.Printf("too many results in staging (%d) ignoring %d results", n, len(results)-maxResults)
results = results[:maxResults]
}
// creating a map to hold the shuffled workIDs
shuffledIDs := make(map[string]string, len(results))
for _, result := range results {
Expand All @@ -51,7 +57,7 @@ func (hook *AddFromStagingHook) RunHook(obs *ocr2keepersv3.AutomationObservation
if len(results) > limit {
results = results[:limit]
}
hook.logger.Printf("adding %d results to observation", len(results))
hook.logger.Printf("adding %d results to observation, out of %d available results", len(results), n)
obs.Performable = append(obs.Performable, results...)

return nil
Expand Down

0 comments on commit f9a7aa2

Please sign in to comment.