public async Task <PipeResult <R> > RunAsync(M model, IPipeCache cache) { var result = await _container.RunAsync(model, cache); if (result.Success == ExecutionResult.Failed && _count > 0) { return(await ReTryAsync(model, cache)); } return(result); }
public static ValueTask RunAsync <T>(this IAsyncContainer <T> container, Action <T> action) { return(container.RunAsync((t, action) => { action(t); return new ValueTask <object?>(default(object)); }, action).AsValueTask()); }
public static ValueTask RunAsync <T>(this IAsyncContainer <T> container, Func <T, ValueTask> action) { return(container.RunAsync(async(t, action) => { await action(t); return default(object?); }, action).AsValueTask()); }
public async Task <PipeResult <R> > RunAsync(M model, IPipeCache cache) { var stopWatch = new Stopwatch(); stopWatch.Start(); var result = await _container.RunAsync(model, cache); stopWatch.Stop(); result.SetElapsed(stopWatch.Elapsed); return(result); }
public async Task <PipeResult <R> > RunAsync(M model, IPipeCache cache) { var result = PipeResult <R> .Default; if (_semaphore == null) { return(await _container.RunAsync(model, cache)); } await _semaphore.WaitAsync(); try { result = await _container.RunAsync(model, cache); } finally { _semaphore.Release(); } return(result); }
public static ValueTask <TResult> RunAsync <T, TResult>(this IAsyncContainer <T> container, Func <T, TResult> func) { return(container.RunAsync((t, func) => new ValueTask <TResult>(func(t)), func)); }
public static ValueTask <TResult> RunAsync <T, TResult, TParam>(this IAsyncContainer <T> container, Func <T, TParam, ValueTask <TResult> > func, TParam param) { return(container.RunAsync(func, param)); }