refactor: use the built-in max/min to simplify the code (#24112)
Signed-off-by: riyueguang <rustruby@outlook.com>
This commit is contained in:
@@ -130,10 +130,7 @@ func (m *Manager) GetPruningHeight(height int64) int64 {
|
||||
// the snapshot `m.pruneSnapshotHeights[0]` is already operated,
|
||||
// so we can prune upto `m.pruneSnapshotHeights[0] + int64(m.snapshotInterval) - 1`
|
||||
snHeight := m.pruneSnapshotHeights[0] + int64(m.snapshotInterval) - 1
|
||||
if snHeight < pruneHeight {
|
||||
return snHeight
|
||||
}
|
||||
return pruneHeight
|
||||
return min(snHeight, pruneHeight)
|
||||
}
|
||||
|
||||
// LoadSnapshotHeights loads the snapshot heights from the database as a crash recovery.
|
||||
|
||||
Reference in New Issue
Block a user