public IActionResult EtherScanHeight() { var bnr = _bsm.GetEtherScanBlockNr().TryGetBlockNumber(); if (bnr <= 0) { return(StatusCode(StatusCodes.Status500InternalServerError)); } return(StatusCode(StatusCodes.Status200OK, bnr)); }
protected override async Task Process() { var bn = _bsm.GetEtherScanBlockNr(); var delay = 100; if (bn != null && (DateTime.UtcNow - bn.TimeStamp).TotalSeconds < _cfg.etherscanRequestDelay) { var timeUntilNextExecution = (_cfg.etherscanRequestDelay * 1000) - (DateTime.UtcNow - bn.TimeStamp).TotalMilliseconds; if (timeUntilNextExecution > delay) { delay = (int)timeUntilNextExecution; } } await Task.Delay(delay); await _bsm.TryUpdateEtherscanBlockHeight(); }