pub struct JobScheduler { /* private fields */ }Expand description
Job scheduler for managing delayed and recurring jobs
Implementations§
Source§impl JobScheduler
impl JobScheduler
Sourcepub fn with_poll_interval(
storage: Arc<dyn Storage>,
poll_interval: Duration,
) -> Self
pub fn with_poll_interval( storage: Arc<dyn Storage>, poll_interval: Duration, ) -> Self
Create a new job scheduler with custom poll interval
Sourcepub async fn schedule_job(
&self,
job: Job,
execute_at: DateTime<Utc>,
reason: impl Into<String>,
) -> Result<()>
pub async fn schedule_job( &self, job: Job, execute_at: DateTime<Utc>, reason: impl Into<String>, ) -> Result<()>
Schedule a job for future execution
Sourcepub async fn schedule_job_in(
&self,
job: Job,
delay: Duration,
reason: impl Into<String>,
) -> Result<()>
pub async fn schedule_job_in( &self, job: Job, delay: Duration, reason: impl Into<String>, ) -> Result<()>
Schedule a job with a delay from now
Sourcepub fn poll_interval(&self) -> Duration
pub fn poll_interval(&self) -> Duration
Get the current poll interval
Auto Trait Implementations§
impl Freeze for JobScheduler
impl !RefUnwindSafe for JobScheduler
impl Send for JobScheduler
impl Sync for JobScheduler
impl Unpin for JobScheduler
impl !UnwindSafe for JobScheduler
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