From 60ea495f4a6124c5bc1ed3ff0592399ada49da74 Mon Sep 17 00:00:00 2001 From: Peter Argue <89119817+peterargue@users.noreply.github.com> Date: Thu, 5 Sep 2024 07:54:20 -0700 Subject: [PATCH 1/2] Throttle sync requests --- engine/common/synchronization/engine.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/common/synchronization/engine.go b/engine/common/synchronization/engine.go index aeae8eb7a8d..06e48ad8762 100644 --- a/engine/common/synchronization/engine.go +++ b/engine/common/synchronization/engine.go @@ -3,6 +3,7 @@ package synchronization import ( "context" "fmt" + "os" "time" "github.com/hashicorp/go-multierror" @@ -423,6 +424,10 @@ func (e *Engine) sendRequests(participants flow.IdentifierList, ranges []chainsy Msg("range requested") e.core.RangeRequested(ran) e.metrics.MessageSent(metrics.EngineSynchronization, metrics.MessageRangeRequest) + + if os.Getenv("DEBUG_THROTTLE_SYNC_REQUESTS") == "1" { + break + } } for _, batch := range batches { @@ -450,6 +455,10 @@ func (e *Engine) sendRequests(participants flow.IdentifierList, ranges []chainsy Msg("batch requested") e.core.BatchRequested(batch) e.metrics.MessageSent(metrics.EngineSynchronization, metrics.MessageBatchRequest) + + if os.Getenv("DEBUG_THROTTLE_SYNC_REQUESTS") == "1" { + break + } } if err := errs.ErrorOrNil(); err != nil { From f40d53e2051532dfffa4b6b64d8e56cd5659e16d Mon Sep 17 00:00:00 2001 From: Peter Argue <89119817+peterargue@users.noreply.github.com> Date: Thu, 5 Sep 2024 08:11:54 -0700 Subject: [PATCH 2/2] remove envvar --- engine/common/synchronization/engine.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/engine/common/synchronization/engine.go b/engine/common/synchronization/engine.go index 06e48ad8762..c15c27a7684 100644 --- a/engine/common/synchronization/engine.go +++ b/engine/common/synchronization/engine.go @@ -3,7 +3,6 @@ package synchronization import ( "context" "fmt" - "os" "time" "github.com/hashicorp/go-multierror" @@ -425,9 +424,7 @@ func (e *Engine) sendRequests(participants flow.IdentifierList, ranges []chainsy e.core.RangeRequested(ran) e.metrics.MessageSent(metrics.EngineSynchronization, metrics.MessageRangeRequest) - if os.Getenv("DEBUG_THROTTLE_SYNC_REQUESTS") == "1" { - break - } + break } for _, batch := range batches { @@ -456,9 +453,7 @@ func (e *Engine) sendRequests(participants flow.IdentifierList, ranges []chainsy e.core.BatchRequested(batch) e.metrics.MessageSent(metrics.EngineSynchronization, metrics.MessageBatchRequest) - if os.Getenv("DEBUG_THROTTLE_SYNC_REQUESTS") == "1" { - break - } + break } if err := errs.ErrorOrNil(); err != nil {