mirror of
https://github.com/traefik/traefik.git
synced 2026-06-17 19:09:29 +03:00
Use modern WaitGroup.Go function in additional places
This commit is contained in:
@@ -515,7 +515,6 @@ func TestDifferentIntervals(t *testing.T) {
|
|||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
wg.Go(func() {
|
wg.Go(func() {
|
||||||
hc.Launch(ctx)
|
hc.Launch(ctx)
|
||||||
wg.Done()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -192,11 +192,9 @@ func TestBasicAuthConcurrentHashOnce(t *testing.T) {
|
|||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(2)
|
|
||||||
|
|
||||||
for range 2 {
|
for range 2 {
|
||||||
go func() {
|
wg.Go(func() {
|
||||||
defer wg.Done()
|
|
||||||
req := testhelpers.MustNewRequest(http.MethodGet, ts.URL, nil)
|
req := testhelpers.MustNewRequest(http.MethodGet, ts.URL, nil)
|
||||||
req.SetBasicAuth("test", "test")
|
req.SetBasicAuth("test", "test")
|
||||||
|
|
||||||
@@ -205,7 +203,7 @@ func TestBasicAuthConcurrentHashOnce(t *testing.T) {
|
|||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, res.StatusCode, "they should be equal")
|
assert.Equal(t, http.StatusOK, res.StatusCode, "they should be equal")
|
||||||
}()
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ func (eps UDPEntryPoints) Stop() {
|
|||||||
|
|
||||||
for epn, ep := range eps {
|
for epn, ep := range eps {
|
||||||
wg.Go(func() {
|
wg.Go(func() {
|
||||||
defer wg.Done()
|
|
||||||
|
|
||||||
logger := log.With().Str(logs.EntryPointName, epn).Logger()
|
logger := log.With().Str(logs.EntryPointName, epn).Logger()
|
||||||
ep.Shutdown(logger.WithContext(context.Background()))
|
ep.Shutdown(logger.WithContext(context.Background()))
|
||||||
|
|
||||||
|
|||||||
@@ -560,13 +560,11 @@ func TestConcurrentResponseTimeUpdates(t *testing.T) {
|
|||||||
updatesPerGoroutine := 20
|
updatesPerGoroutine := 20
|
||||||
|
|
||||||
for i := range numGoroutines {
|
for i := range numGoroutines {
|
||||||
wg.Add(1)
|
wg.Go(func() {
|
||||||
go func(id int) {
|
|
||||||
defer wg.Done()
|
|
||||||
for range updatesPerGoroutine {
|
for range updatesPerGoroutine {
|
||||||
handler.updateResponseTime(time.Duration(id+1) * time.Millisecond)
|
handler.updateResponseTime(time.Duration(i+1) * time.Millisecond)
|
||||||
}
|
}
|
||||||
}(i)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|||||||
Reference in New Issue
Block a user