Skip to content

Commit

Permalink
clarify intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
raskchanky committed May 20, 2022
1 parent 53289f6 commit 75677ea
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions physical/raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,18 @@ func NewRaftBackend(conf map[string]string, logger log.Logger) (physical.Backend
updateInterval = interval
}

if reconcileInterval != 0 && updateInterval != 0 && reconcileInterval < updateInterval {
return nil, fmt.Errorf("autopilot_reconcile_interval should be larger than autopilot_update_interval")
effectiveReconcileInterval := autopilot.DefaultReconcileInterval
effectiveUpdateInterval := autopilot.DefaultUpdateInterval

if reconcileInterval != 0 {
effectiveReconcileInterval = reconcileInterval
}
if updateInterval != 0 {
effectiveUpdateInterval = updateInterval
}

if effectiveReconcileInterval < effectiveUpdateInterval {
return nil, fmt.Errorf("autopilot_reconcile_interval (%v) should be larger than autopilot_update_interval (%v)", effectiveReconcileInterval, effectiveUpdateInterval)
}

return &RaftBackend{
Expand Down

0 comments on commit 75677ea

Please sign in to comment.