protected virtual Task <bool> FireCancellableNodeObserverEventAsync(ISnCancellableEvent 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.FromResult(false)); }
private async Task <bool> CallNodeObserversAsync(ISnCancellableEvent snEvent, List <Type> disabledNodeObservers) { if (!IsFeatureEnabled(1)) { return(false); } var tasks = Providers.Instance.NodeObservers .Where(x => !disabledNodeObservers?.Contains(x.GetType()) ?? true) .Select(x => FireCancellableNodeObserverEventAsync(snEvent, x)) .ToArray(); await Task.WhenAll(tasks).ConfigureAwait(false); var canceled = tasks.Any(t => t.Result); return(canceled); }
public Task <bool> FireCancellableNodeObserverEventAsync(ISnCancellableEvent snEvent, List <Type> disabledNodeObservers) { // Cancellable event is used only the NodeObserver infrastructure return(CallNodeObserversAsync(snEvent, disabledNodeObservers)); }
public Task <bool> FireCancellableNodeObserverEventAsync(ISnCancellableEvent snEvent, List <Type> disabledNodeObservers) { return(Task.FromResult(false)); }
protected override async T.Task <bool> FireCancellableNodeObserverEventAsync(ISnCancellableEvent snEvent, NodeObserver nodeObserver, CancellationToken cancel = default) { using (var op = SnTrace.Test.StartOperation( $"NodeObserverAction simulation: {nodeObserver.GetType().Name} {snEvent.GetType().Name}")) { await T.Task.Delay(10, cancel).ConfigureAwait(false); op.Successful = true; } var result = snEvent.CancellableEventArgs.Cancel; result |= await base.FireCancellableNodeObserverEventAsync(snEvent, nodeObserver, cancel); return(result); }