Skip to content

Commit

Permalink
fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-develope committed Mar 20, 2024
1 parent f7ff2c1 commit 654f5a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions store/root/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"slices"
"sync"
"time"

"github.com/cockroachdb/errors"
Expand Down Expand Up @@ -374,14 +375,21 @@ func (s *Store) StartMigration() error {

s.isMigrating = true

mtx := sync.Mutex{}
mtx.Lock()
go func() {
version := s.lastCommitInfo.Version
s.logger.Info("starting migration", "version", version)
mtx.Unlock()
if err := s.migrationManager.Start(version, s.chChangeset, s.chDone); err != nil {
s.logger.Error("failed to start migration", "err", err)
}
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism

// wait for the migration manager to start
mtx.Lock()
defer mtx.Unlock()

return nil
}

Expand Down

0 comments on commit 654f5a1

Please sign in to comment.