Prevent panic if autopilot health is requested prior to leader establishment finishing. (#9204)
This commit is contained in:
parent
c01e0756d8
commit
197a37a860
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
autopilot: Prevent panic when requesting the autopilot health immediately after a leader is elected.
|
||||
```
|
|
@ -100,6 +100,12 @@ func (op *Operator) ServerHealth(args *structs.DCSpecificRequest, reply *structs
|
|||
|
||||
state := op.srv.autopilot.GetState()
|
||||
|
||||
if state == nil {
|
||||
// this behavior seems odd but its functionally equivalent to 1.8.5 where if
|
||||
// autopilot didn't have a health reply yet it would just return no error
|
||||
return nil
|
||||
}
|
||||
|
||||
health := structs.AutopilotHealthReply{
|
||||
Healthy: state.Healthy,
|
||||
FailureTolerance: state.FailureTolerance,
|
||||
|
|
Loading…
Reference in New Issue