2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-07-14 23:37:35 +08:00

Fix bug related to concurrently executing server state changes

This commit is contained in:
Ken Hibino
2022-01-12 09:10:56 -08:00
committed by GitHub
parent aa26f3819e
commit 25832e5e95
6 changed files with 124 additions and 125 deletions

View File

@@ -583,30 +583,6 @@ func TestSchedulerEnqueueEventEncoding(t *testing.T) {
}
}
// Test for status being accessed by multiple goroutines.
// Run with -race flag to check for data race.
func TestStatusConcurrentAccess(t *testing.T) {
status := NewServerState()
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
status.Get()
_ = status.String()
}()
wg.Add(1)
go func() {
defer wg.Done()
status.Set(StateClosed)
_ = status.String()
}()
wg.Wait()
}
// Test for cancelations being accessed by multiple goroutines.
// Run with -race flag to check for data race.
func TestCancelationsConcurrentAccess(t *testing.T) {