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); }
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); }
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); }
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); }
public Task FireNodeObserverEventAsync(INodeObserverEvent snEvent, List <Type> disabledNodeObservers) { return(Task.CompletedTask); }