Open sandboxFocus

Constructor BackgroundTaskScheduler

BackgroundTaskScheduler(IServiceProvider?, bool)

Initializes a new instance of the BackgroundTaskScheduler class.

Declaration
public BackgroundTaskScheduler(IServiceProvider? serviceProvider, bool sequential = false)
Parameters
Type Name Description
IServiceProvider serviceProvider

The service provider.

bool sequential

If true, tasks are executed sequentially.

BackgroundTaskScheduler(IServiceProvider?, IRetryPolicy?, bool, int, int)

Initializes a new instance of the BackgroundTaskScheduler class.

Declaration
public BackgroundTaskScheduler(IServiceProvider? serviceProvider, IRetryPolicy? retryPolicy, bool sequential, int maxConcurrency = 50, int overloadThreshold = 500)
Parameters
Type Name Description
IServiceProvider serviceProvider

The service provider.

IRetryPolicy retryPolicy

Optional retry policy for background tasks. If null, tasks are not retried.

bool sequential

If true, tasks are executed sequentially.

int maxConcurrency

The maximum number of concurrent background tasks. Default is 50.

int overloadThreshold

The number of queued tasks above maxConcurrency at which the scheduler is considered overloaded. Default is 500.