mirror of
https://github.com/juanfont/headscale.git
synced 2026-09-18 22:34:54 +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:
committed by
Kristoffer Dalby
parent
245b81401c
commit
373c60efe3
@@ -104,17 +104,13 @@ func TestConcurrentPutNodeSameGivenNameAllUnique(t *testing.T) {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
results := make(chan string, N)
|
||||
for i := range N {
|
||||
wg.Add(1)
|
||||
|
||||
go func(id int) {
|
||||
defer wg.Done()
|
||||
|
||||
for id := range N {
|
||||
wg.Go(func() {
|
||||
n := createTestNode(types.NodeID(id+1), 1, "alice", "laptop") //nolint:gosec // test ids
|
||||
|
||||
view := store.PutNode(n)
|
||||
results <- view.GivenName()
|
||||
}(i)
|
||||
})
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
||||
Reference in New Issue
Block a user