process method
Starts processing queued jobs.
This method is typically used in a worker loop.
Example:
await queueDriver.process(); // start the worker
Implementation
@override
Future<void> process() async {
// Find next ready job
final readyJob = _findNextReadyJob();
if (readyJob == null) return;
// Mark as processing
_processingJobs.add(readyJob.id);
try {
await executeJob(readyJob);
} finally {
// Remove from processing set
_processingJobs.remove(readyJob.id);
// Remove completed/failed job from queue
if (readyJob.status == JobStatus.completed ||
readyJob.status == JobStatus.deadLettered) {
_queue.remove(readyJob);
}
// Update queue depth metrics
if (metrics != null) {
metrics!.recordQueueDepth(_queue.length);
}
}
}