diff --git a/sweepbatcher/sweep_batch.go b/sweepbatcher/sweep_batch.go index 4415d3fc..58cdf19d 100644 --- a/sweepbatcher/sweep_batch.go +++ b/sweepbatcher/sweep_batch.go @@ -2439,6 +2439,7 @@ func (b *batch) isComplete() bool { if err != nil && err != ErrBatchShuttingDown { return false } + return b.state == Confirmed } diff --git a/sweepbatcher/sweep_batcher_test.go b/sweepbatcher/sweep_batcher_test.go index 009e8da0..2fccd17f 100644 --- a/sweepbatcher/sweep_batcher_test.go +++ b/sweepbatcher/sweep_batcher_test.go @@ -4149,9 +4149,9 @@ func testSweepBatcherHandleSweepRace(t *testing.T, store testStore, go func() { defer addWG.Done() - // After this goroutine completes, stop the goroutine that handles - // registrations as well. Give it one second to finish the last - // AddSweep to prevent goroutine leaks. + // After this goroutine completes, stop the goroutine that + // handles registrations as well. Give it one second to finish + // the last AddSweep to prevent goroutine leaks. defer time.AfterFunc(time.Second, confCancel) for {