pub struct WorkerConnection { /* private fields */ }
Expand description
The connection to Redis. Required to enqueue and dequeue jobs.
Each WorkerConnection
has exactly one actual Redis connection.
Implementations§
Source§impl WorkerConnection
impl WorkerConnection
Sourcepub fn enqueue_to(
&self,
iden: QueueIdentifier,
name: JobName,
args: &Args,
retry_count: RetryCount,
) -> RobinResult<()>
pub fn enqueue_to( &self, iden: QueueIdentifier, name: JobName, args: &Args, retry_count: RetryCount, ) -> RobinResult<()>
Put a job into the queue.
This method will enqueue the job regardless of what the retry_count
is.
Not reenqueueing jobs that failed too much is handled at another level.
Sourcepub fn retry(
&self,
name: JobName,
args: &Args,
retry_count: RetryCount,
) -> RobinResult<()>
pub fn retry( &self, name: JobName, args: &Args, retry_count: RetryCount, ) -> RobinResult<()>
Put the job into the retry queue.
Sourcepub fn dequeue_from<'a>(
&'a self,
iden: QueueIdentifier,
timeout: DequeueTimeout,
) -> Result<(Box<dyn Job + Send>, String, RetryCount), NoJobDequeued>
pub fn dequeue_from<'a>( &'a self, iden: QueueIdentifier, timeout: DequeueTimeout, ) -> Result<(Box<dyn Job + Send>, String, RetryCount), NoJobDequeued>
Pull the first job out of the queue.
Sourcepub fn delete_all(&self) -> RobinResult<()>
pub fn delete_all(&self) -> RobinResult<()>
Delete all jobs from all queues
Sourcepub fn size(&self, iden: QueueIdentifier) -> RobinResult<usize>
pub fn size(&self, iden: QueueIdentifier) -> RobinResult<usize>
The number of jobs in the queue
Sourcepub fn main_queue_size(&self) -> RobinResult<usize>
pub fn main_queue_size(&self) -> RobinResult<usize>
The number of jobs in the main queue
Sourcepub fn retry_queue_size(&self) -> RobinResult<usize>
pub fn retry_queue_size(&self) -> RobinResult<usize>
The number of jobs in the retry queue
Sourcepub fn is_queue_empty(&self, iden: QueueIdentifier) -> RobinResult<bool>
pub fn is_queue_empty(&self, iden: QueueIdentifier) -> RobinResult<bool>
true
if there are 0 jobs in the queue, false
otherwise
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WorkerConnection
impl !RefUnwindSafe for WorkerConnection
impl !Send for WorkerConnection
impl !Sync for WorkerConnection
impl Unpin for WorkerConnection
impl !UnwindSafe for WorkerConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more