Skip to content

Commit

Permalink
CV document database opens for baseapp.Close
Browse files Browse the repository at this point in the history
  • Loading branch information
chillyvee committed Aug 7, 2023
1 parent f543ae9 commit 79c2b97
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,12 +1057,18 @@ func (app *BaseApp) ProcessProposalVerifyTx(txBz []byte) (sdk.Tx, error) {

// Close is called in start cmd to gracefully cleanup resources.
func (app *BaseApp) Close() error {
// Close app.db (opened by cosmos-sdk/server/start.go call to openDB)
app.logger.Info("Closing application.db")
_ = app.db.Close()

// Close app.snapshotManager
// - opened when app chains use cosmos-sdk/server/util.go/DefaultBaseappOptions (boilerplate)
// - which calls cosmos-sdk/server/util.go/GetSnapshotStore
// - which is passed to baseapp/options.go/SetSnapshot
// - to set app.snapshotManager = snapshots.NewManager
if app.snapshotManager != nil {
_ = app.snapshotManager.Close()
app.logger.Info("Closing snapshots/metadata.db")
app.snapshotManager.Close()
}

return nil
}

0 comments on commit 79c2b97

Please sign in to comment.