Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #20817 #616

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
import (
"fmt"
"io"
"sync"

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

Expand Down Expand Up @@ -122,9 +123,15 @@
// 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)
Comment on lines +129 to +132

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
Loading