fix: upgrade deps and medernize codes

This commit is contained in:
krau
2026-03-05 19:40:25 +08:00
parent af28738235
commit 602fc251d8
4 changed files with 114 additions and 123 deletions

View File

@@ -82,17 +82,13 @@ func TestConcurrencySafety(t *testing.T) {
var wg sync.WaitGroup
n := 1000
// producers
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
for i := range n {
q.Add(newTask(fmt.Sprintf("p%d", i)))
}
}()
})
// consumers
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
count := 0
for count < n {
_, err := q.Get()
@@ -101,6 +97,6 @@ func TestConcurrencySafety(t *testing.T) {
}
count++
}
}()
})
wg.Wait()
}