I've a list of records that I need to distribute equally among limited no. of Tasks.
Once assigned, those tasks should call following code for each record that is assigned to them and return each result simultaneously(updating Processed to N or Y and Status to Pass or Failed in real time) without waiting for all at once:
//Here we are calling an API with POST method and expecting a Tuple<message, StatusCode>
var pricingResult = await shippingService.PublishConfigShipping(apiRequest);
if (pricingResult.Item2 == System.Net.HttpStatusCode.OK)
{
//We are saving the data to sql db here
result = await repository.SaveConfigShipping(data);
}
I want to keep the tasks spawn limited so that API doesn't crash or data saving to DB doesn't slow down or crash. Can someone please let me know how to call this piece of code using Tasks?