Skip to content

Commit

Permalink
minor fixes of config (#579)
Browse files Browse the repository at this point in the history
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
  • Loading branch information
HagarMeir committed Mar 17, 2024
1 parent 584daef commit 02af08a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ type Configuration struct {
// DecisionsPerLeader is the number of decisions reached by a leader before there is a leader rotation.
DecisionsPerLeader uint64

// RequestMaxBytes total allowed size of the single request
// RequestMaxBytes total allowed size of a single request.
RequestMaxBytes uint64

// RequestPoolSubmitTimeout the total amount of time client can wait for submission of single
// request into request pool
// RequestPoolSubmitTimeout the total amount of time a client can wait for the submission of a single
// request into the request pool.
RequestPoolSubmitTimeout time.Duration
}

Expand Down Expand Up @@ -115,7 +115,7 @@ var DefaultConfig = Configuration{

func (c Configuration) Validate() error {
if c.SelfID == 0 {
return errors.Errorf("SelfID is lower than or equal to zero")
return errors.Errorf("SelfID should be greater than zero")
}
if c.RequestBatchMaxCount == 0 {
return errors.Errorf("RequestBatchMaxCount should be greater than zero")
Expand Down Expand Up @@ -171,14 +171,15 @@ func (c Configuration) Validate() error {
if c.ViewChangeResendInterval > c.ViewChangeTimeout {
return errors.Errorf("ViewChangeResendInterval is bigger than ViewChangeTimeout")
}
if c.LeaderRotation && c.DecisionsPerLeader <= 0 {
if c.LeaderRotation && c.DecisionsPerLeader == 0 {
return errors.Errorf("DecisionsPerLeader should be greater than zero when leader rotation is active")
}

if !c.LeaderRotation && c.DecisionsPerLeader != 0 {
return errors.Errorf("DecisionsPerLeader should be zero when leader rotation is off")
}
if c.RequestMaxBytes == 0 {
return errors.Errorf("RequestMaxBytes should be greater than zero")
}

if c.RequestPoolSubmitTimeout <= 0 {
return errors.Errorf("RequestPoolSubmitTimeout should be greater than zero")
}
Expand Down

0 comments on commit 02af08a

Please sign in to comment.