refactor: keep batch.Close error handle logic consistance (#21812)

This commit is contained in:
lfz941
2024-09-26 20:21:49 +00:00
committed by GitHub
parent 89d96e88a0
commit 648ef5fb2d
2 changed files with 5 additions and 4 deletions
+3 -1
View File
@@ -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 {