Пример #1
0
        /// <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);
                }
            }
        }
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
        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);
                    }
                }
            }
        }