Overview
Workers are the execution engines of the task management system. Each worker operates as an independent async task, receiving jobs through channels, executing them via the task executor, and reporting results back to the pool. Workers are managed through the worker pool.Architecture
A worker is fundamentally an async event loop that processes jobs until shutdown. Each worker has a UUID-based worker ID, holds a reference to the sharedTaskExecutor, and communicates through three distinct channels:
- Job reception - Receives new jobs via an mpsc channel
- Completion reporting - Reports results back to the pool via an mpsc channel
- Shutdown signal - Receives termination requests via a oneshot channel
tokio::select!, processing whichever event arrives first. When a job arrives, the worker executes it and reports the result. When a shutdown signal arrives, the worker terminates gracefully.
Configuration
Worker behavior is controlled through configuration options:- Compatible task types (enabling worker specialization)
- Execution mode (single or batch processing)
- Batch size limits
- Timeout values for batch collection and idle shutdown