From c5991fc66d30e02d61ad0b4a8068201c85b9c5dc Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 4 Mar 2025 12:20:24 +0300 Subject: [PATCH] [#339] pool/tree: Fix linter issues Signed-off-by: Alex Vanin --- pool/tree/circuitbreaker.go | 2 +- pool/tree/circuitbreaker_test.go | 2 +- pool/tree/pool.go | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pool/tree/circuitbreaker.go b/pool/tree/circuitbreaker.go index c494dddf..db63fb8f 100644 --- a/pool/tree/circuitbreaker.go +++ b/pool/tree/circuitbreaker.go @@ -23,7 +23,7 @@ type ( var ErrCBClosed = errors.New("circuit breaker is closed") -func NewCircuitBreaker(breakDuration time.Duration, threshold int) *circuitBreaker { +func newCircuitBreaker(breakDuration time.Duration, threshold int) *circuitBreaker { return &circuitBreaker{ breakDuration: breakDuration, threshold: threshold, diff --git a/pool/tree/circuitbreaker_test.go b/pool/tree/circuitbreaker_test.go index 4f7974c5..d15e920e 100644 --- a/pool/tree/circuitbreaker_test.go +++ b/pool/tree/circuitbreaker_test.go @@ -12,7 +12,7 @@ func TestCircuitBreaker(t *testing.T) { remoteErr := errors.New("service is being synchronized") breakDuration := 1 * time.Second threshold := 10 - cb := NewCircuitBreaker(breakDuration, threshold) + cb := newCircuitBreaker(breakDuration, threshold) // Hit threshold for i := 0; i < threshold; i++ { diff --git a/pool/tree/pool.go b/pool/tree/pool.go index 5c7fbce4..60c205f7 100644 --- a/pool/tree/pool.go +++ b/pool/tree/pool.go @@ -254,7 +254,7 @@ func NewPool(options InitParameters) (*Pool, error) { methods: methods, netMapInfoSource: options.netMapInfoSource, clientMap: make(map[uint64]client), - cb: NewCircuitBreaker( + cb: newCircuitBreaker( options.circuitBreakerDuration, options.circuitBreakerThreshold, ), @@ -802,7 +802,6 @@ func fillDefaultInitParams(params *InitParameters) { if params.circuitBreakerDuration <= 0 { params.circuitBreakerDuration = defaultCircuitBreakerDuration - } if params.circuitBreakerThreshold <= 0 {