TestimoX

API Reference

Class

ParallelQueryHelper

Namespace ComputerX.Common
Assembly ComputerX
Modifiers static

Minimal helper for running an async workload over a set of inputs with bounded parallelism.

Inheritance

  • Object
  • ParallelQueryHelper

Methods

public static IAsyncEnumerable<T> RunAsync<T>(IEnumerable<String> items, Func<String, Task<IEnumerable<T>>> work, Int32 degreeOfParallelism, CancellationToken token = null) #
Returns: IAsyncEnumerable<T>

Type Parameters

T

Parameters

items IEnumerable<String> requiredposition: 0
work Func<String, Task<IEnumerable<T>>> requiredposition: 1
degreeOfParallelism Int32 requiredposition: 2
token CancellationToken = null optionalposition: 3
RunAsync``1(System.Collections.Generic.IEnumerable{System.String} items, System.Func{System.String,System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{``0}}} work, System.Int32 degreeOfParallelism, System.Threading.CancellationToken token) #

Runs work for each input with a maximum of degreeOfParallelism concurrent tasks and yields the results.

Type Parameters

T
Item type yielded by the worker.

Parameters

items System.Collections.Generic.IEnumerable{System.String} required
Sequence of inputs (e.g., hostnames).
work System.Func{System.String,System.Threading.Tasks.Task{System.Collections.Generic.IEnumerable{``0}}} required
Async function returning zero-or-more results for an input.
degreeOfParallelism System.Int32 required
Max parallelism to use.
token System.Threading.CancellationToken required
Cancellation token.