예제 #1
0
        public async Task <int> ExecuteAsync(
            CancellationToken cancellationToken = default(CancellationToken))
        {
            TRepositoryFactory repoFactory = default(TRepositoryFactory);

            try
            {
                repoFactory = CreateRepositoryFactoryCallback(Configuration);

                BlockchainProcessor processor = CreateBlockChainProcessor(repoFactory);

                if (TargetConfiguration.ToBlock != null)
                {
                    await processor.ExecuteAsync(TargetConfiguration.ToBlock.Value, cancellationToken, TargetConfiguration.FromBlock);
                }
                else
                {
                    await processor.ExecuteAsync(cancellationToken, TargetConfiguration.FromBlock);
                }

                return(0);
            }
            catch (Exception ex)
            {
                log?.Error(ex);
                if (repoFactory != null)
                {
                    DisposeAction?.Invoke(repoFactory);
                }
                return(1);
            }
        }
예제 #2
0
        public void Dispose()
        {
            if (!IsSingletone && Result is IDisposable disposable)
            {
                disposable.Dispose();
            }

            DisposeAction?.Invoke();
        }
예제 #3
0
 public void Dispose()
 {
     DisposeAction.Invoke();
     DisposableLock.Dispose();
 }
예제 #4
0
 public void Dispose() => _dispose?.Invoke(value: _value, explicitDispose: true);