Optimize C# Function - Concurrent Task Async Await【10 USD 1 Day】
Budget: $10 – $30 USD
Optimize one C# Function. Only expert C# developer cound finish this task.
The function reads a list of codes(300 short strings).
For each code, use HttpClient to get JSON data (small data) from 3rd party API, then save to database.
The function currently stops at around 120 items (before finish all 300 items), maybe due to run out of resources.
Code skeleton below:
Parallel.ForEach(codes, code => {
HttpClient client = new();
HttpResponseMessage response = client.GetAsync(licence).Result;
saveToDatabase(response);
client.Dispose();
});
Can you improve the function and save all 300 items to database in 15 seconds?
You will work remotely on my computer via AnyDesk.
The function reads a list of codes(300 short strings).
For each code, use HttpClient to get JSON data (small data) from 3rd party API, then save to database.
The function currently stops at around 120 items (before finish all 300 items), maybe due to run out of resources.
Code skeleton below:
Parallel.ForEach(codes, code => {
HttpClient client = new();
HttpResponseMessage response = client.GetAsync(licence).Result;
saveToDatabase(response);
client.Dispose();
});
Can you improve the function and save all 300 items to database in 15 seconds?
You will work remotely on my computer via AnyDesk.