From bfe4dba1d6184698d203ed5dbb20cae281630392 Mon Sep 17 00:00:00 2001 From: Akshay Aggarwal Date: Tue, 5 Sep 2023 19:26:35 +0100 Subject: [PATCH 1/2] Add overall limit on sampled upkeeps to release pressure on runner --- pkg/v3/flows/conditional.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/v3/flows/conditional.go b/pkg/v3/flows/conditional.go index d9f33db3..5603d3c1 100644 --- a/pkg/v3/flows/conditional.go +++ b/pkg/v3/flows/conditional.go @@ -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 @@ -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 sampled conditionals %d, limiting to max", size, MaxSampledConditionals) + size = MaxSampledConditionals + } if len(upkeeps) < size { size = len(upkeeps) } From c20f9a7493c3568e44b4621b338e55d5b56320c1 Mon Sep 17 00:00:00 2001 From: Akshay Aggarwal Date: Tue, 5 Sep 2023 19:33:20 +0100 Subject: [PATCH 2/2] update log message --- pkg/v3/flows/conditional.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/v3/flows/conditional.go b/pkg/v3/flows/conditional.go index 5603d3c1..4a6e4b34 100644 --- a/pkg/v3/flows/conditional.go +++ b/pkg/v3/flows/conditional.go @@ -94,7 +94,7 @@ func (s *sampler) Value(ctx context.Context) ([]ocr2keepers.UpkeepPayload, error return nil, nil } if size > MaxSampledConditionals { - s.logger.Printf("Required sample size %d exceeds max sampled conditionals %d, limiting to max", 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 {