Added configuration options for snapshot threshold and snapshot interval

This commit is contained in:
Kelvin Clement Mwinuka
2024-01-25 18:59:04 +08:00
parent bdebdea7ad
commit 97f0f142a6
3 changed files with 13 additions and 5 deletions

View File

@@ -39,8 +39,8 @@ func (r *Raft) RaftInit(ctx context.Context) {
raftConfig := raft.DefaultConfig()
raftConfig.LocalID = raft.ServerID(conf.ServerID)
raftConfig.SnapshotThreshold = 5
raftConfig.SnapshotInterval = 5 * time.Second
raftConfig.SnapshotThreshold = conf.SnapShotThreshold
raftConfig.SnapshotInterval = time.Duration(conf.SnapshotInterval) * time.Second
var logStore raft.LogStore
var stableStore raft.StableStore