mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-20 07:39:36 +08:00
fix: upgrade deps and medernize codes
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user