ax(mining): rename wg to waitGroup in circuit breaker concurrency test
AX Principle 1: predictable names over short names. wg requires mental mapping to WaitGroup; waitGroup is self-documenting. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
96a450eff5
commit
db80ce6dde
1 changed files with 4 additions and 4 deletions
|
|
@ -302,11 +302,11 @@ func TestCircuitBreaker_Reset_Good(t *testing.T) {
|
|||
func TestCircuitBreaker_Concurrency_Ugly(t *testing.T) {
|
||||
cb := NewCircuitBreaker("test", DefaultCircuitBreakerConfig())
|
||||
|
||||
var wg sync.WaitGroup
|
||||
var waitGroup sync.WaitGroup
|
||||
for i := 0; i < 100; i++ {
|
||||
wg.Add(1)
|
||||
waitGroup.Add(1)
|
||||
go func(n int) {
|
||||
defer wg.Done()
|
||||
defer waitGroup.Done()
|
||||
cb.Execute(func() (interface{}, error) { //nolint:errcheck
|
||||
if n%3 == 0 {
|
||||
return nil, errors.New("fail")
|
||||
|
|
@ -315,7 +315,7 @@ func TestCircuitBreaker_Concurrency_Ugly(t *testing.T) {
|
|||
})
|
||||
}(i)
|
||||
}
|
||||
wg.Wait()
|
||||
waitGroup.Wait()
|
||||
|
||||
_ = cb.State()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue