diff --git a/examples/process-jobs/src/main.rs b/examples/process-jobs/src/main.rs index 95e03a3..a804965 100644 --- a/examples/process-jobs/src/main.rs +++ b/examples/process-jobs/src/main.rs @@ -6,7 +6,7 @@ use futures::{ future::{lazy, IntoFuture}, Future, }; -use jobs::{JobRunner, MaxRetries, Processor}; +use jobs::{Backoff, JobRunner, MaxRetries, Processor}; #[derive(Clone, Debug, Deserialize, Serialize)] struct MyJobArguments { @@ -27,6 +27,10 @@ impl Processor for MyProcessor { MaxRetries::Count(1) } + fn backoff_strategy() -> Backoff { + Backoff::Exponential(2) + } + fn process(&self, args: Self::Arguments) -> Box + Send> { println!("args: {:?}", args); @@ -68,7 +72,7 @@ fn main() { .map(|job| { tokio::spawn( handle - .queue(MyProcessor::new_job(job, None).unwrap()) + .queue(MyProcessor::new_job(job, None, None).unwrap()) .then(|_| Ok(())), ); })