Skip to content

Commit

Permalink
Add overall limit on sampled upkeeps (#264)
Browse files Browse the repository at this point in the history
* Add overall limit on sampled upkeeps to release pressure on runner

* update log message
  • Loading branch information
infiloop2 authored Sep 6, 2023
1 parent e4ca3c6 commit 71c9c91
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/v3/flows/conditional.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
const (
// This is the ticker interval for sampling conditional flow
SamplingConditionInterval = 3 * time.Second
// Maximum number of upkeeps to be sampled in every round
MaxSampledConditionals = 300
// This is the ticker interval for final conditional flow
FinalConditionalInterval = 1 * time.Second
// These are the maximum number of conditional upkeeps dequeued on every tick from proposal queue in FinalConditionalFlow
Expand Down Expand Up @@ -91,6 +93,10 @@ func (s *sampler) Value(ctx context.Context) ([]ocr2keepers.UpkeepPayload, error
if size <= 0 {
return nil, nil
}
if size > MaxSampledConditionals {
s.logger.Printf("Required sample size %d exceeds max allowed conditional samples %d, limiting to max", size, MaxSampledConditionals)
size = MaxSampledConditionals
}
if len(upkeeps) < size {
size = len(upkeeps)
}
Expand Down

0 comments on commit 71c9c91

Please sign in to comment.