Exemple #1
0
        public async Task <int> UpdateTransactionHistory()
        {
            int count = 0;

            try
            {
                string continuationToken = null;
                do
                {
                    var observations = await _observationRepository.GetAllAsync(_batchSize, continuationToken);

                    foreach (var item in observations.Items)
                    {
                        count += await ProcessTransactionObservation(item);
                    }
                    continuationToken = observations.ContinuationToken;
                } while (continuationToken != null);

                _lastJobError = null;
            }
            catch (Exception ex)
            {
                _lastJobError = _lastJobError = $"Error in job {nameof(TransactionHistoryService)}.{nameof(UpdateTransactionHistory)}: {ex.Message}";
                await _log.WriteErrorAsync(nameof(TransactionHistoryService), nameof(UpdateTransactionHistory),
                                           "Failed to execute transaction history update", ex);
            }
            return(count);
        }
Exemple #2
0
        public async Task <int> UpdateWalletBalances()
        {
            int count = 0;

            try
            {
                string continuationToken = null;
                do
                {
                    var observations = await _observationRepository.GetAllAsync(_batchSize, continuationToken);

                    foreach (var item in observations.Items)
                    {
                        await ProcessWallet(item.Address);

                        count++;
                    }
                    continuationToken = observations.ContinuationToken;
                } while (continuationToken != null);

                _lastJobError = null;
            }
            catch (Exception ex)
            {
                _lastJobError = $"Error in job {nameof(BalanceService)}.{nameof(UpdateWalletBalances)}: {ex.Message}";
                await _log.WriteErrorAsync(nameof(BalanceService), nameof(UpdateWalletBalances),
                                           "Failed to execute balances update", ex);
            }
            return(count);
        }
Exemple #3
0
        public async Task <int> UpdateBroadcastsInProgress(int batchSize)
        {
            var count = 0;

            try
            {
                string continuationToken = null;
                do
                {
                    var observations = await _observationRepository.GetAllAsync(batchSize, continuationToken);

                    foreach (var item in observations.Items)
                    {
                        await ProcessBroadcastInProgress(item.OperationId);

                        count++;
                    }
                    continuationToken = observations.ContinuationToken;
                } while (continuationToken != null);

                _lastJobError = null;
            }
            catch (Exception ex)
            {
                _lastJobError = $"Error in job {nameof(TransactionService)}.{nameof(UpdateBroadcastsInProgress)}: {ex.Message}";
                throw new JobExecutionException("Failed to execute broadcast in progress updates", ex, count);
            }

            return(count);
        }