push method
Pushes a QueueJob to the queue with optional delay.
The delay allows deferring the job execution.
Example:
await queueDriver.push(SendEmailJob(), delay: Duration(seconds: 30));
Implementation
@override
Future<void> push(QueueJob job, {Duration? delay}) async {
await _ensureLoaded();
final context = createJobContext(job, delay: delay);
// Track metrics
if (metrics != null) {
metrics!.jobQueued(job.runtimeType.toString());
metrics!.recordQueueDepth(_memoryCache.length + 1);
}
_memoryCache.add(context);
await _persistToFile();
}