forked from TrueCloudLab/frostfs-sdk-go
[#339] pool/tree: Fix linter issues
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
f78fb6dcb0
commit
c5991fc66d
3 changed files with 3 additions and 4 deletions
|
@ -23,7 +23,7 @@ type (
|
||||||
|
|
||||||
var ErrCBClosed = errors.New("circuit breaker is closed")
|
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{
|
return &circuitBreaker{
|
||||||
breakDuration: breakDuration,
|
breakDuration: breakDuration,
|
||||||
threshold: threshold,
|
threshold: threshold,
|
||||||
|
|
|
@ -12,7 +12,7 @@ func TestCircuitBreaker(t *testing.T) {
|
||||||
remoteErr := errors.New("service is being synchronized")
|
remoteErr := errors.New("service is being synchronized")
|
||||||
breakDuration := 1 * time.Second
|
breakDuration := 1 * time.Second
|
||||||
threshold := 10
|
threshold := 10
|
||||||
cb := NewCircuitBreaker(breakDuration, threshold)
|
cb := newCircuitBreaker(breakDuration, threshold)
|
||||||
|
|
||||||
// Hit threshold
|
// Hit threshold
|
||||||
for i := 0; i < threshold; i++ {
|
for i := 0; i < threshold; i++ {
|
||||||
|
|
|
@ -254,7 +254,7 @@ func NewPool(options InitParameters) (*Pool, error) {
|
||||||
methods: methods,
|
methods: methods,
|
||||||
netMapInfoSource: options.netMapInfoSource,
|
netMapInfoSource: options.netMapInfoSource,
|
||||||
clientMap: make(map[uint64]client),
|
clientMap: make(map[uint64]client),
|
||||||
cb: NewCircuitBreaker(
|
cb: newCircuitBreaker(
|
||||||
options.circuitBreakerDuration,
|
options.circuitBreakerDuration,
|
||||||
options.circuitBreakerThreshold,
|
options.circuitBreakerThreshold,
|
||||||
),
|
),
|
||||||
|
@ -802,7 +802,6 @@ func fillDefaultInitParams(params *InitParameters) {
|
||||||
|
|
||||||
if params.circuitBreakerDuration <= 0 {
|
if params.circuitBreakerDuration <= 0 {
|
||||||
params.circuitBreakerDuration = defaultCircuitBreakerDuration
|
params.circuitBreakerDuration = defaultCircuitBreakerDuration
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if params.circuitBreakerThreshold <= 0 {
|
if params.circuitBreakerThreshold <= 0 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue