Merge pull request #126 from 2311719626/fix/logs
fix(server): 修复 task log 模块多个问题及数据竞争
This commit is contained in:
@@ -354,14 +354,14 @@ func TestSubscribeTask_ConcurrentSafety(t *testing.T) {
|
||||
const goroutines = 50
|
||||
|
||||
// 并发订阅
|
||||
cancels := make([]func(), 0, goroutines)
|
||||
cancels := make([]func(), goroutines)
|
||||
for i := 0; i < goroutines; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
go func(idx int) {
|
||||
defer wg.Done()
|
||||
_, cancel := svc.SubscribeTask(taskID)
|
||||
cancels = append(cancels, cancel)
|
||||
}()
|
||||
cancels[idx] = cancel
|
||||
}(i)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user