add a mutex

This commit is contained in:
John Roesler 2025-11-26 13:34:49 -06:00
parent 3b7e8a5ea8
commit ebafb713c0
No known key found for this signature in database
GPG Key ID: 3AA260B9FCA0A6E1
1 changed files with 4 additions and 3 deletions

View File

@ -585,6 +585,7 @@ func TestScheduler_Start(t *testing.T) {
s := newTestScheduler(t)
var counter int
var mu sync.Mutex
_, err := s.NewJob(
DurationJob(
@ -592,19 +593,19 @@ func TestScheduler_Start(t *testing.T) {
),
NewTask(
func() {
mu.Lock()
counter++
mu.Unlock()
},
),
)
require.NoError(t, err)
s.Start()
time.Sleep(100 * time.Millisecond)
s.Start()
time.Sleep(100 * time.Millisecond)
s.Start()
time.Sleep(800 * time.Millisecond)
time.Sleep(1000 * time.Millisecond)
require.NoError(t, s.Shutdown())