I have been reading this Microsoft blog around optimizing CosmosDB initialisation.
TLDR; you can improve latency on your first few calls by using CreateAndInitializeAsync
As my application is hosted on AKS the pods could potentially be restarted so this optimization would be nice to have.
I would typically use ConfigureServices to register a singleton instance of CosmosClient in an IServiceCollection, however this cannot be run asynchronously. I could run CreateAndInitializeAsync synchronously instead but that could potentially block application start-up. A transient failure with CreateAndInitializeAsync could also block start-up if used here.
Is there a way of safely utilizing CreateAndInitializeAsync in a .NET Core Application?