Skip to content

Commit c6d6d18

Browse files
authored
Fix race condition for the heartbeat shutdown (#152)
1 parent e39b066 commit c6d6d18

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/jobs/heartbeatjob/heartbeatjob_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ func TestShutdown_StopsJob(t *testing.T) {
150150
job.Register(ctx, svc)
151151

152152
time.Sleep(10 * time.Millisecond)
153-
countBeforeShutdown := callCount.Load()
154153
job.Shutdown()
154+
countAtShutdown := callCount.Load()
155155

156156
time.Sleep(10 * time.Millisecond)
157-
countAfterShutdown := callCount.Load()
157+
countAfterWait := callCount.Load()
158158

159-
assert.Equal(t, countBeforeShutdown, countAfterShutdown)
159+
assert.Equal(t, countAtShutdown, countAfterWait)
160160
}
161161

162162
// TestShutdown_WaitsForCompletion - Shutdown() waits for goroutine to finish

0 commit comments

Comments
 (0)