Exemplo n.º 1
0
        public async Task WarmUp(string clientId)
        {
            var wallets = await _privateWalletsRepository.GetStoredWallets(clientId);

            foreach (var wallet in wallets)
            {
                await _ninjaFacade.SendBalanceRequest(wallet.WalletAddress);
            }
        }
Exemplo n.º 2
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            _addressesObservable = Observable
                                   .FromEventPattern <BalanceNotCalculatedEventArgs>(
                h => _ninjaFacade.BalanceNotCalculated += h,
                h => _ninjaFacade.BalanceNotCalculated -= h).Delay(_attemptDelay).Subscribe(pattern =>
            {
                if (pattern.EventArgs.AttemptsCount < _attemptsCount)
                {
                    _log.WriteWarning("Ninja balance poller", pattern.EventArgs.ToJson(), "balance has not been calculated. Retry.");

                    _ninjaFacade.SendBalanceRequest(pattern.EventArgs.Address, pattern.EventArgs.AttemptsCount + 1);
                }
                else
                {
                    _log.WriteError("Ninja balance poller", pattern.EventArgs);
                }
            });

            return(Task.CompletedTask);
        }