in Common/ApiWrappers/BaseBatchApiWrapper.cs [19:63]
public async Task ExecuteWitBatchRequests(
IList<(int SourceId, WitBatchRequest WitBatchRequest)> sourceIdToWitBatchRequests,
IMigrationContext migrationContext,
IBatchMigrationContext batchContext,
bool bypassRules = true,
bool verifyOnFailure = false)
{
if (sourceIdToWitBatchRequests == null || sourceIdToWitBatchRequests.Count == 0)
{
Logger.LogError(LogDestination.All, $"Expected a non empty request list for batch {batchContext.BatchId}");
return;
}
IEnumerable<int> sourceIds = sourceIdToWitBatchRequests.Select(w => w.SourceId);
IList<WitBatchRequest> witBatchRequests = sourceIdToWitBatchRequests.Select(w => w.WitBatchRequest).ToList();
IList<WitBatchResponse> witBatchResponses = null;
try
{
var client = this.GetWorkItemTrackingHttpClient(migrationContext);
witBatchResponses = await RetryHelper.RetryAsync(
async () =>
{
return await ApiWrapperHelpers.ExecuteBatchRequest(client, witBatchRequests);
},
async (requestId, exception) =>
{
if (verifyOnFailure)
{
return await ApiWrapperHelpers.HandleBatchException(requestId, exception, migrationContext, batchContext, sourceIds);
}
else
{
return exception;
}
},
5);
}
catch (Exception e)
{
Logger.LogError(LogDestination.All, e, $"Exception caught while calling ExecuteWitBatchRequests() in batch with batchId {batchContext.BatchId}:");
}
HandleBatchResponses(sourceIdToWitBatchRequests, witBatchResponses, migrationContext, batchContext);
}