Skip to content

Commit

Permalink
Backport cosmos#20817
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon committed Jul 3, 2024
1 parent df7a478 commit 5ff9c26
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion store/cachemulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cachemulti
import (
"fmt"
"io"
"sync"

dbm "github.com/cometbft/cometbft-db"

Expand Down Expand Up @@ -122,9 +123,15 @@ func (cms Store) GetStoreType() types.StoreType {
// Write calls Write on each underlying store.
func (cms Store) Write() {
cms.db.Write()
wg := sync.WaitGroup{}
wg.Add(len(cms.stores))
for _, store := range cms.stores {
store.Write()
go func(s types.CacheWrap) {
defer wg.Done()
store.Write()

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / Analyze

loopclosure: loop variable store captured by func literal (govet)

Check failure on line 131 in store/cachemulti/store.go

View workflow job for this annotation

GitHub Actions / golangci-lint

loopclosure: loop variable store captured by func literal (govet)
}(store)

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
}
wg.Wait()
}

// Implements CacheWrapper.
Expand Down

0 comments on commit 5ff9c26

Please sign in to comment.