Don't launch all parallel tasks immediately

It seems that the runtime is actually smarter than I thought, and can optimize tasks creation for maximum performance better than we'd do
This commit is contained in:
JustArchi
2016-07-02 22:05:29 +02:00
parent ab4630c191
commit cbf212aff5
2 changed files with 3 additions and 7 deletions

View File

@@ -107,9 +107,7 @@ namespace ArchiSteamFarm {
}
}
List<Task<ParseTradeResult>> tasks = tradeOffers.Select(ParseTrade).ToList();
ParseTradeResult[] results = await Task.WhenAll(tasks).ConfigureAwait(false);
ParseTradeResult[] results = await Task.WhenAll(tradeOffers.Select(ParseTrade)).ConfigureAwait(false);
if (results.Any(result => result == ParseTradeResult.AcceptedWithItemLose)) {
await Task.Delay(1000).ConfigureAwait(false); // Sometimes we can be too fast for Steam servers to generate confirmations, wait a short moment
HashSet<ulong> tradeIDs = new HashSet<ulong>(tradeOffers.Select(tradeOffer => tradeOffer.TradeOfferID));