Closed BryanWilhite closed 5 years ago
the subtlety here is that my intention is that all the feed downloads share the same HttpClient
this means the downloads cannot run in parallel (so no Task.WhenAll
/ Task.WaitAll
):
internal void DownloadFeeds(FeedsMetadata meta, string rootDirectory)
{
if (string.IsNullOrEmpty(meta.FeedsDirectory))
throw new NullReferenceException("The expected feeds directory is not configured.");
foreach (var feed in meta.Feeds)
this.DownloadFeedAsync(feed, rootDirectory).GetAwaiter().GetResult();
}
the explicit use of foreach
with GetAwaiter().GetResult()
shows the intent to run several async
tasks sequentially
the above caveats suggest that i should not use GetAwaiter().GetResult()
in, say, Azure Functions
depends on https://github.com/BryanWilhite/SonghayCore/issues/18