/// <summary> /// Refreshe contracts queue every 12 hours /// </summary> /// <param name="timer"></param> /// <returns></returns> public async Task RefreshQueue([TimerTrigger("12:00:00")] TimerInfo timer) { for (var i = 0; i < _contractQueueService.Count(); i++) { try { var contract = await _contractQueueService.GetContract(); await _contractQueueService.PushContract(contract); } catch (Exception e) { await _logger.WriteError("EthereumWebJob", "RefreshQueue", "", e); } } }
public async Task <IHttpActionResult> NewClient() { // check contract queue var count = _contractQueueService.Count(); // check ethereum node var block = await _contractService.GetCurrentBlock(); return(Ok(new { QueueCount = count, BlockNumber = block })); }
public override async Task Execute() { for (var i = 0; i < _contractQueueService.Count(); i++) { try { var contract = await _contractQueueService.GetContract(); await _contractQueueService.PushContract(contract); } catch (Exception e) { await _logger.WriteError("EthereumWebJob", "RefreshQueue", "", e); } } }
public override async Task Execute() { await InternalBalanceCheck(); if (_contractQueueService.Count() < _settings.MinContractPoolLength) { for (var i = 0; i < (_settings.MaxContractPoolLength - _settings.MinContractPoolLength) / ContractsPerRequest; i++) { await InternalBalanceCheck(); var contracts = await _contractService.GenerateUserContracts(ContractsPerRequest); foreach (var contract in contracts) { await _contractQueueService.PushContract(contract); } } } }