Changing Pause Monitor to poll for ROLL FORWARD PAUSED or a terminal state.

This commit is contained in:
Renan DelValle 2019-09-12 19:00:14 -07:00
parent a698e3b8dd
commit ace5da6bd3
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9

View file

@ -117,19 +117,21 @@ func (m *Monitor) JobUpdateQuery(
// PausedUpdateMonitor polls Aurora for information about a job update until the job update has entered into
// a ROLL_FORWARD_PAUSED state.
func (m *Monitor) PausedUpdateMonitor(key aurora.JobUpdateKey, interval, timeout time.Duration) (bool, error) {
_, err := m.JobUpdateQuery(aurora.JobUpdateQuery{
UpdateStatuses: []aurora.JobUpdateStatus{aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED},
Key: &key,
Limit: 1,
},
status, err := m.JobUpdateStatus(
key,
append(TerminalUpdateStates(), aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED),
interval,
timeout)
if err != nil {
return false, errors.Wrap(err, "update has not entered paused state")
return false, err
}
return true, err
if status != aurora.JobUpdateStatus_ROLL_FORWARD_PAUSED {
return false, errors.Errorf("update is in a terminal state %v", status)
}
return true, nil
}
// Monitor a Job until all instances enter one of the LIVE_STATES