[][src]Trait crony::Job

pub trait Job: Send + Sync {
    fn schedule(&self) -> Schedule;
fn handle(&self); fn is_active(&self) -> bool { ... }
fn allow_parallel_runs(&self) -> bool { ... }
fn should_run(&self) -> bool { ... }
fn now(&self) -> DateTime<Utc> { ... } }

Required methods

fn schedule(&self) -> Schedule[src]

Define the run schedule for your job

fn handle(&self)[src]

This is where your jobs magic happens, define the action that will happen once the cron start running your job

If this method panics, your entire job will panic and that may or may not make the whole runner panic. Handle your errors properly and don't let it panic.

Loading content...

Provided methods

fn is_active(&self) -> bool[src]

Default implementation of is_active method will make this job always active

fn allow_parallel_runs(&self) -> bool[src]

In case your job takes longer to finish and it's scheduled to start again (while its still running), default behaviour will skip the next run while one instance is already running. (if your OS has enough threads, and is spawning a thread for next job)

To override this behaviour and enable it to run in parallel with other instances of self, return true on this instance.

fn should_run(&self) -> bool[src]

Decide wheather or not to start running your job

fn now(&self) -> DateTime<Utc>[src]

Simple output that will return current time so you don't have to do so in your job if you wish to display the time of the run.

Loading content...

Implementors

Loading content...