I have inherited some code which was written in web api that I am not sure I understand 100%. It looks similar to this:
public async Task<IHttpActionResult> GetAll()
{
var items = await repo.GetItems();
Task.Run(async () =>
{
await MakeCallToExternalServiceAsync();
await MakeCallToAnotherExternalServiceAsync();
});
return Ok(items);
}
After the call to the repository to get some data from the data store, the code fires off a task to make some calls to some external services. Assuming none of these calls fail are there any other issues with this? Since the request is finished are these calls going to be aborted? There might be resources that are "request scope" using Autofac - would those get disposed since the request has finished?