Open AmitKumarDas opened 6 years ago
An approach that some code pieces in Kubernetes follows is:
// LeaseDuration is the duration that non-leader candidates will
// wait to force acquire leadership. This is measured against time of
// last observed ack. Defaults to 15 seconds.
func LeaseDuration(leaseDuration time.Duration) func(*ProvisionController) error {
return func(c *ProvisionController) error {
if c.HasRun() {
return errRuntime
}
c.leaseDuration = leaseDuration
return nil
}
}