mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-02 11:44:05 +09:00
all: use sync.WaitGroup.Go
Drops the Add/Done bookkeeping, which in batcher.go was spread across three functions.
This commit is contained in:
1 parent
245b81401c
commit
373c60efe3
9 files changed
+46
-106
No files matched your search
@@ -96,22 +96,16 @@ func TestConnectDisconnectRace(t *testing.T) {
|
||||
|
||||
start := make(chan struct{})
|
||||
|
||||
wg.Add(2)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
wg.Go(func() {
|
||||
<-start
|
||||
|
||||
_, _ = srv.State().Disconnect(r2ID, gen)
|
||||
}()
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
})
|
||||
wg.Go(func() {
|
||||
<-start
|
||||
|
||||
_, _ = srv.State().Connect(r2ID)
|
||||
}()
|
||||
})
|
||||
|
||||
close(start)
|
||||
wg.Wait()
|
||||
|
||||
@@ -494,16 +494,12 @@ func TestRaceBatcherContention(t *testing.T) {
|
||||
srv.App.Change(c)
|
||||
})
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
var c2 *servertest.TestClient
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
wg.Go(func() {
|
||||
c2 = servertest.NewClient(t, srv, "rtcon-node2",
|
||||
servertest.WithUser(user))
|
||||
}()
|
||||
})
|
||||
|
||||
wg.Wait()
|
||||
|
||||
|
||||
Reference in new issue
Block a user