Beispiel #1
0
        public IEnumerable <HealthIssue> GetHealthIssues()
        {
            var issues = new HealthIssuesCollection();

            // TODO: Check gathered health statistics, and add appropriate health issues message to issues
            return(issues);
        }
        public IEnumerable<HealthIssue> GetHealthIssues()
        {
            var issues = new HealthIssuesCollection();

            foreach (var blockchain in _settings.Blockchains)
            {
                issues.Add($"{blockchain.Type} - API", blockchain.ApiUrl);
                issues.Add($"{blockchain.Type} - Hot Wallet", blockchain.HotWalletAddress);
            }

            return issues;
        }
Beispiel #3
0
        public async Task <IEnumerable <HealthIssue> > GetHealthIssues()
        {
            var issues = new HealthIssuesCollection();

            var  delayTime                       = 10;//seconds
            bool isNodeAvailable                 = false;
            CancellationTokenSource cts          = new CancellationTokenSource(TimeSpan.FromSeconds(delayTime));
            var           currentBlockTask       = _contractService.GetCurrentBlock();
            var           currentGasPriceHexTask = _web3.Eth.GasPrice.SendRequestAsync();
            StringBuilder errorMsg               = new StringBuilder();

            try
            {
                await Task.WhenAny(new Task[] {
                    currentBlockTask,
                    currentGasPriceHexTask,
                    Task.Delay(TimeSpan.FromSeconds(delayTime + 1), cts.Token)
                });

                isNodeAvailable = true;
            }
            catch (AggregateException e)
            {
                foreach (var item in e.InnerExceptions)
                {
                    errorMsg.AppendLine($"{item.Message}");
                }
            }
            catch (TaskCanceledException e)
            {
                errorMsg.AppendLine($"Timeout happened within {delayTime} seconds");
            }
            catch (Exception e)
            {
                errorMsg.AppendLine(e.Message);
            }

            var block = isNodeAvailable ? await currentBlockTask : System.Numerics.BigInteger.Zero;
            var currentGasPriceHex = isNodeAvailable ? await currentGasPriceHexTask :
                                     new Nethereum.Hex.HexTypes.HexBigInteger(System.Numerics.BigInteger.Zero);

            issues.Add("BlockNumber", block.ToString());
            issues.Add("Version", Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion);
            issues.Add("CurrentGasPrice", currentGasPriceHex.Value.ToString());
            issues.Add("IsNodeAvailable", isNodeAvailable.ToString());
            issues.Add("NodeIssues", errorMsg.ToString());

            return(issues);
        }
        public IEnumerable <HealthIssue> GetHealthIssues()
        {
            var issues = new HealthIssuesCollection();

            // TODO: Check gathered health statistics, and add appropriate health issues message to issues

            var blockchainReaderError = BlockchainReader.Error;

            if (blockchainReaderError != null)
            {
                issues.Add(blockchainReaderError.GetType().Name, blockchainReaderError.Message);
            }

            return(issues);
        }
        public IEnumerable <HealthIssue> GetHealthIssues()
        {
            var issues = new HealthIssuesCollection();

            if (_balanceService.GetLastJobError() != null)
            {
                issues.Add(JobExecutionIssueType, _balanceService.GetLastJobError());
            }
            if (_txHistoryService.GetLastJobError() != null)
            {
                issues.Add(JobExecutionIssueType, _txHistoryService.GetLastJobError());
            }
            if (_transactionService.GetLastJobError() != null)
            {
                issues.Add(JobExecutionIssueType, _transactionService.GetLastJobError());
            }

            return(issues);
        }
Beispiel #6
0
        public IEnumerable <HealthIssue> GetHealthIssues()
        {
            var issues = new HealthIssuesCollection();

            return(issues);
        }