pub struct JobRunnerOptions { /* private fields */ }
Expand description
Type used to build a job runner.
Implementations§
Source§impl JobRunnerOptions
impl JobRunnerOptions
Sourcepub fn new<F: Fn(CurrentJob) + Send + Sync + 'static>(
pool: &Pool<Postgres>,
f: F,
) -> Self
pub fn new<F: Fn(CurrentJob) + Send + Sync + 'static>( pool: &Pool<Postgres>, f: F, ) -> Self
Begin constructing a new job runner using the specified connection pool, and the provided execution function.
Sourcepub fn set_concurrency(
&mut self,
min_concurrency: usize,
max_concurrency: usize,
) -> &mut Self
pub fn set_concurrency( &mut self, min_concurrency: usize, max_concurrency: usize, ) -> &mut Self
Set the concurrency limits for this job runner. When the number of active jobs falls below the minimum, the runner will poll for more, up to the maximum.
The difference between the min and max will dictate the maximum batch size which can be received: larger batch sizes are more efficient.
Sourcepub fn set_channel_names<'a>(
&'a mut self,
channel_names: &[&str],
) -> &'a mut Self
pub fn set_channel_names<'a>( &'a mut self, channel_names: &[&str], ) -> &'a mut Self
Set the channel names which this job runner will subscribe to. If unspecified, the job runner will subscribe to all channels.
Sourcepub fn set_keep_alive(&mut self, keep_alive: bool) -> &mut Self
pub fn set_keep_alive(&mut self, keep_alive: bool) -> &mut Self
Choose whether to automatically keep jobs alive whilst they’re still
running. Defaults to true
.
Sourcepub async fn run(&self) -> Result<JobRunnerHandle, Error>
pub async fn run(&self) -> Result<JobRunnerHandle, Error>
Start the job runner in the background. The job runner will stop when the returned handle is dropped.
Trait Implementations§
Source§impl Clone for JobRunnerOptions
impl Clone for JobRunnerOptions
Source§fn clone(&self) -> JobRunnerOptions
fn clone(&self) -> JobRunnerOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for JobRunnerOptions
impl !RefUnwindSafe for JobRunnerOptions
impl Send for JobRunnerOptions
impl Sync for JobRunnerOptions
impl Unpin for JobRunnerOptions
impl !UnwindSafe for JobRunnerOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more