diff --git a/tools/code/common/Http.cs b/tools/code/common/Http.cs index 61f09213..0fabf654 100644 --- a/tools/code/common/Http.cs +++ b/tools/code/common/Http.cs @@ -402,7 +402,7 @@ private static bool ShouldRetryInner(HttpMessage message, Exception? exception) (message, exception) switch { ({ Response.Status: 422 or 409 }, _) when HasManagementApiRequestFailedError(message.Response) => true, - ({ Response.Status: 409 }, _) when HasConflictError(message.Response) && HasOperationOnTheApiIsInProgressMessage(message.Response) => true, + ({ Response.Status: 409 }, _) when HasConflictOrPessimisticConcurrencyConflictError(message.Response) && HasOperationOnTheApiIsInProgressMessage(message.Response) => true, ({ Response.Status: 412 }, _) => true, ({ Response.Status: 429 }, _) => true, _ => false @@ -419,9 +419,12 @@ private static bool HasManagementApiRequestFailedError(Response response) => .Where(code => code.Equals("ManagementApiRequestFailed", StringComparison.OrdinalIgnoreCase)) .IsSome; - private static bool HasConflictError(Response response) => + private static bool HasConflictOrPessimisticConcurrencyConflictError(Response response) => TryGetErrorCode(response) - .Where(code => code.Equals("Conflict", StringComparison.OrdinalIgnoreCase)) + .Where(code => + code.Equals("Conflict", StringComparison.OrdinalIgnoreCase) || + code.Equals("PessimisticConcurrencyConflict", StringComparison.OrdinalIgnoreCase) + ) .IsSome; private static bool HasOperationOnTheApiIsInProgressMessage(Response response) =>