protected override async Task RunInternalAsync(CancellationToken token) { WriteToHeartBeatLog(); if (!BaseData.CurrentPriceStorage.IsAddedOrUpdated) { WriteToWorkerLog($"{Country} doesn't have updated current price storage."); return; } IReadOnlyList <IMemberStock> memberStocks = await DatabaseOperations.GetMemberStocksAsync().ConfigureAwait(false); if (memberStocks == null || memberStocks.Count == 0) { return; } List <Task> tasks = new List <Task>(); foreach (IMemberStock memberStock in memberStocks) { if (!memberStock.IsNotify) { continue; } ITradingStrategy strategy = _buySellStrategyProvider.GetBuyStrategy(memberStock, BaseData, TestStatus); if (strategy == null) { continue; } Task t = strategy.ExecuteAsync(token); tasks.Add(t); } if (tasks.Count == 0) { return; } try { // TODO :timeout ? await Task.WhenAll(tasks.ToArray()).ConfigureAwait(false); } catch { // TODO: log? } }