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 {
await _ensureLoaded();
// Find next ready job
final readyJob = _findNextReadyJob();
if (readyJob == null) return;
try {
await executeJob(readyJob);
} finally {
// Remove completed/failed job
if (readyJob.status == JobStatus.completed ||
readyJob.status == JobStatus.deadLettered) {
_memoryCache.remove(readyJob);
await _persistToFile();
}
// Update metrics
if (metrics != null) {
metrics!.recordQueueDepth(_memoryCache.length);
}
}
}