move error messages out of retry

This commit is contained in:
Sergey Dudoladov 2021-01-07 15:39:48 +01:00
parent d9755db4d5
commit ca129eb9da
1 changed files with 2 additions and 3 deletions

View File

@ -321,17 +321,16 @@ func (c *Cluster) isSafeToRecreatePods(pods *v1.PodList) bool {
state, err = c.patroni.GetPatroniMemberState(&pod) state, err = c.patroni.GetPatroniMemberState(&pod)
if err != nil { if err != nil {
c.logger.Errorf("failed to get Patroni state for pod: %s", err)
return false, err return false, err
} else if state == "creating replica" { } else if state == "creating replica" {
c.logger.Warningf("cannot re-create replica %s: it is currently being initialized", pod.Name) return false, fmt.Errorf("cannot re-create replica %s: it is currently being initialized", pod.Name)
return false, nil
} }
return true, nil return true, nil
}, },
) )
if err != nil { if err != nil {
c.logger.Errorf("failed to get Patroni state for pod: %s", err)
return false return false
} }