Exemple #1
0
 protected virtual Task FireNodeObserverEventAsync(INodeObserverEvent snEvent,
                                                   NodeObserver nodeObserver, CancellationToken cancel = default)
 {
     //TODO:<?event: Ensure that this method does not throw any exception (but trace and log).
     //snEvent.NodeObserverAction(nodeObserver);
     //TODO:event: Not implemented yet
     return(Task.CompletedTask);
 }
Exemple #2
0
        public Task FireNodeObserverEventAsync(INodeObserverEvent snEvent, List <Type> disabledNodeObservers)
        {
            // Call observers but do not wait
            var nodeObserverTask = CallNodeObserversAsync(snEvent, disabledNodeObservers);

            // Call forward to work with more event processor
            var task = FireEventAsync(snEvent, nodeObserverTask);

            return(task);
        }
Exemple #3
0
            protected override async T.Task FireNodeObserverEventAsync(INodeObserverEvent snEvent, NodeObserver nodeObserver,
                                                                       CancellationToken cancel = default)
            {
                using (var op = SnTrace.Test.StartOperation(
                           $"NodeObserverAction simulation: {nodeObserver.GetType().Name} {snEvent.GetType().Name}"))
                {
                    await T.Task.Delay(20, cancel).ConfigureAwait(false);

                    op.Successful = true;
                }

                await base.FireNodeObserverEventAsync(snEvent, nodeObserver, cancel);
            }
Exemple #4
0
        private async Task CallNodeObserversAsync(INodeObserverEvent snEvent, List <Type> disabledNodeObservers)
        {
            if (!IsFeatureEnabled(2))
            {
                return;
            }

            var tasks = Providers.Instance.NodeObservers
                        .Where(x => !disabledNodeObservers?.Contains(x.GetType()) ?? true)
                        .Select(x => FireNodeObserverEventAsync(snEvent, x))
                        .ToArray();

            await Task.WhenAll(tasks).ConfigureAwait(false);
        }
Exemple #5
0
 public Task FireNodeObserverEventAsync(INodeObserverEvent snEvent, List <Type> disabledNodeObservers)
 {
     return(Task.CompletedTask);
 }