diff --git a/store/cachemulti/store.go b/store/cachemulti/store.go index a162910fe5a5..58fc5738bf10 100644 --- a/store/cachemulti/store.go +++ b/store/cachemulti/store.go @@ -3,6 +3,7 @@ package cachemulti import ( "fmt" "io" + "sync" dbm "github.com/cometbft/cometbft-db" @@ -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() + }(store) } + wg.Wait() } // Implements CacheWrapper.