Ejemplo n.º 1
0
        public async Task Invoke(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Invoked timercoinmarket");
            try
            {
                _logger.LogInformation(NoticeStore.NoticesCoinMarket.Count.ToString());
                _logger.LogInformation(CurrencyInfoStore.CoinMarkets.Count.ToString());

                NoticeStore.ClearCoinMarket();

                //_alertRepository.DeleteMany(x=> x.NotifyCost == null && string.IsNullOrEmpty(x.PercentNotify));

                var users = _userRepository.GetItems(z => z.NotifyCoinMarket).ToList(); //+

                var currencyPairs = await _client.GetCoinMarket();

                CurrencyInfoStore.AddCoinMarket(currencyPairs);

                var notifications = _currencyService
                                    .CreateNotifications(users, CurrencyInfoStore.CoinMarkets, 2, _alertRepository);

                await _notifyer.Notify(notifications);
            }
            catch (Exception e)
            {
                _logger.LogError("Timer coinmarket", e.Message);
            }
        }
        public async Task Invoke(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Invoked timercoinmarket");
            try
            {
                var currencyPairs = await _client.GetCoinMarket();

                CurrencyInfoStore.AddCoinMarket(currencyPairs);
            }
            catch (Exception e)
            {
                _logger.LogError("Timer coinmarket", e.Message);
            }
        }