refactor: keep batch.Close error handle logic consistance (#21812)
This commit is contained in:
parent
89d96e88a0
commit
648ef5fb2d
@ -1147,7 +1147,9 @@ func (rs *Store) flushMetadata(db corestore.KVStoreWithBatch, version int64, cIn
|
||||
rs.logger.Debug("flushing metadata", "height", version)
|
||||
batch := db.NewBatch()
|
||||
defer func() {
|
||||
_ = batch.Close()
|
||||
if err := batch.Close(); err != nil {
|
||||
rs.logger.Error("call flushMetadata error on batch close", "err", err)
|
||||
}
|
||||
}()
|
||||
|
||||
if cInfo != nil {
|
||||
|
||||
@ -2,6 +2,7 @@ package commitment
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
corestore "cosmossdk.io/core/store"
|
||||
@ -158,9 +159,7 @@ func (m *MetadataStore) deleteRemovedStoreKeys(version uint64, removeStore func(
|
||||
|
||||
batch := m.kv.NewBatch()
|
||||
defer func() {
|
||||
if berr := batch.Close(); berr != nil {
|
||||
err = berr
|
||||
}
|
||||
err = errors.Join(err, batch.Close())
|
||||
}()
|
||||
for _, storeKey := range removedStoreKeys {
|
||||
if err := removeStore(storeKey, version); err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user