From 54ed7dab3982dfd667bf7ad3afcd6c6fbc8f3c61 Mon Sep 17 00:00:00 2001 From: zakir-code <80246097+zakir-code@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:04:22 +0800 Subject: [PATCH] perf: start the goroutine after need to create a snapshot (#17158) --- store/CHANGELOG.md | 5 +++++ store/snapshots/manager.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/store/CHANGELOG.md b/store/CHANGELOG.md index 7b8c1821cc..f308dffc9a 100644 --- a/store/CHANGELOG.md +++ b/store/CHANGELOG.md @@ -25,6 +25,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Improvements + +* [#17158](https://github.com/cosmos/cosmos-sdk/pull/17158) Start the goroutine after need to create a snapshot. + + ## [v1.0.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store%2Fv1.0.0-alpha.1) - 2023-07-11 ### Features diff --git a/store/snapshots/manager.go b/store/snapshots/manager.go index f0c8f85682..78671c2a12 100644 --- a/store/snapshots/manager.go +++ b/store/snapshots/manager.go @@ -514,7 +514,8 @@ func (m *Manager) SnapshotIfApplicable(height int64) { m.logger.Debug("snapshot is skipped", "height", height) return } - m.snapshot(height) + // start the routine after need to create a snapshot + go m.snapshot(height) } // shouldTakeSnapshot returns true is snapshot should be taken at height.