From ace5da6bd3732020788a383490fbc03d0b4007aa Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Thu, 12 Sep 2019 19:00:14 -0700 Subject: [PATCH] Changing Pause Monitor to poll for ROLL FORWARD PAUSED or a terminal state. --- monitors.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/monitors.go b/monitors.go index 452261c..4e45cbe 100644 --- a/monitors.go +++ b/monitors.go @@ -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