You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// getChangeUUIDAndCheckStatus returns the UUID of a change, as selected by --uuid or --change, or a change with the specified status and having --ticket-link
// Success: we have a UUID and status matches the expected status
253
+
return*uuidPtr, nil
254
+
}
255
+
}
256
+
}
257
+
// Log the error and retry if not the last attempt
258
+
ifattempt<maxRetries {
259
+
logFields:= log.Fields{
260
+
"ovm.change.ticketLink": ticketLink,
261
+
"expectedStatus": expectedStatus.String(),
262
+
"attempt": attempt,
263
+
"maxRetries": maxRetries,
264
+
"currentStatus": currentStatus.String(),
265
+
}
266
+
iferr!=nil {
267
+
logFields["error"] =err.Error()
268
+
log.WithContext(ctx).WithFields(logFields).Debug("failed to get change by ticket link, retrying")
269
+
} else {
270
+
log.WithContext(ctx).WithFields(logFields).Debug("change found but status does not match, retrying")
233
271
}
272
+
time.Sleep(retryDelay)
234
273
}
235
274
}
236
-
237
-
iferrNotFound&&changeUuid==uuid.Nil {
238
-
returnuuid.Nil, fmt.Errorf("no change found with ticket link %v and status %v", ticketLink, expectedStatus.String())
275
+
iferr!=nil {
276
+
// Final attempt failed with an error
277
+
returnuuid.Nil, fmt.Errorf("error looking up change with ticket link %v after %d attempts: %w", ticketLink, maxRetries, err)
239
278
}
240
-
241
-
returnchangeUuid, nil
279
+
// Final attempt found a change but status did not match
280
+
returnuuid.Nil, fmt.Errorf("change %s found with ticket link %v. Change status %v does not match expected status %v after %d attempts", change.Msg.GetChange().GetMetadata().GetUUIDParsed(), ticketLink, currentStatus.String(), expectedStatus.String(), maxRetries)
0 commit comments