From 89eb549c447245a438d93807a9f597eeeb576e0c Mon Sep 17 00:00:00 2001 From: asonix Date: Mon, 27 May 2019 20:35:02 -0500 Subject: [PATCH] Update example, readme --- README.md | 2 +- examples/actix-example/src/main.rs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e07b821..7c15123 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ fn main() -> Result<(), Error> { // Configure and start our workers WorkerConfig::new(move || MyState::new("My App")) - .register(MyProcessor(queue_handle.clone())) + .register(MyProcessor) .set_processor_count(DEFAULT_QUEUE, 16) .start(queue_handle.clone()); diff --git a/examples/actix-example/src/main.rs b/examples/actix-example/src/main.rs index 3befe8c..04a0e9a 100644 --- a/examples/actix-example/src/main.rs +++ b/examples/actix-example/src/main.rs @@ -1,7 +1,5 @@ use actix::System; -use background_jobs::{ - Backoff, Job, MaxRetries, Processor, QueueHandle, ServerConfig, WorkerConfig, -}; +use background_jobs::{Backoff, Job, MaxRetries, Processor, ServerConfig, WorkerConfig}; use failure::Error; use futures::{future::ok, Future}; use serde_derive::{Deserialize, Serialize}; @@ -19,8 +17,8 @@ pub struct MyJob { other_usize: usize, } -#[derive(Clone)] -pub struct MyProcessor(pub QueueHandle); +#[derive(Clone, Debug)] +pub struct MyProcessor; fn main() -> Result<(), Error> { // First set up the Actix System to ensure we have a runtime to spawn jobs on. @@ -44,7 +42,7 @@ fn main() -> Result<(), Error> { // Configure and start our workers WorkerConfig::new(move || MyState::new("My App")) - .register(MyProcessor(queue_handle.clone())) + .register(MyProcessor) .set_processor_count(DEFAULT_QUEUE, 16) .start(queue_handle.clone());