-
Notifications
You must be signed in to change notification settings - Fork 16
WorkerConfiguration
The worker configuration drives how many workers are used to process work, and how the workers respond to stop requests.
For Sync queues, the worker handles both the de-queue of the work and the processing.
For the Async queues, the worker de-queues items, but hands off processing to another thread. While its expected that only 1 worker is used for Async queues, multiple workers may be used. This might be needed if the tasks are very short lived, and the transport can't dequeue quick enough to keep the task factory at full capacity.
The worker count property sets how many threads are used to de-queue and process work
queue.Configuration.Worker.WorkerCount = 4;
You can tell the queue to use a single worker to poll the transport for new work. The other workers will be worker up when work is found.
NOTE: This setting has not or little affect on transports that don't require polling. For instance, the Redis transport notifies workers of new work without using polling.
queue.Configuration.Worker.SingleWorkerWhenNoWorkFound = true;
You can tell the workers to abort when cancel requests are not respected inside of the cancel window. Enabling this is generally not something you want to do. Aborting a thread can be unpredictable. Async queues will always ignore this setting, as they are unable to abort threads started by the Task Factory.
queue.Configuration.Worker.AbortWorkerThreadsWhenStopping = false;
This setting controls how long the queue waits after issuing a cancel. After this time has expired, the queue will:
- Abort the worker threads
Or
- Wait until all threads have died.
queue.Configuration.Worker.TimeToWaitForWorkersToCancel = TimeSpan.FromSeconds(10);
This setting controls how long before the queue issues a cancel request, after being told to stop. When the stop request is issued, workers will stop dequeing. After this time limit has been reached, the cancel token will be triggered, telling user code to stop or abort their work.
queue.Configuration.Worker.TimeToWaitForWorkersToStop = TimeSpan.FromSeconds(10);
For any issues please use the GitHub issues