Run 3 operation in parallel with 2 operations dependent on result of 1st operation C#
I have below method where, there is a call to a database in AppendExpandOption2DataAsync
& AppendExpandOption1DataAsync
if the ODataQuery options is passed and valid. However, the data that OData needs is returned by GetMyData
and thus the execution of AppendExpandOption2DataAsync
& AppendExpandOption1DataAsync
shoudl be hold until the GetData is returned, since GetData can also give a 500 or a 404. But my below approach is increasing latency as I am doing two DB calls. (1 for GetMyData & other for AppendExpandOption2DataAsync
or AppendExpandOption1DataAsync
). How can I optimize this code for minimal latency without changing its execution output.