Is it acceptable to use ConfigureAwait(false)
in this case? I’m using it.net 8, ASP.NET Core Web Api
public Task TryInvokeWorkers(CancellationToken cancellationToken)
{
var tasks = _types.Select(type => type.Instance, type.Id, cancellationToken));
return Task.WhenAll(tasks);
}
public async Task TryInvokeWorker(object instance, string id, CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
await _mediator.Send(instance, cancellationToken).ConfigureAwait(false);
await Task.Delay(TimeSpan.FromMinutes(_configuration.GetValue<int>("Delay:" + id)),
cancellationToken).ConfigureAwait(false);
}
}