mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-22 03:51:00 +00:00
Update example, readme
This commit is contained in:
parent
6ad80ea4dc
commit
89eb549c44
2 changed files with 5 additions and 7 deletions
|
@ -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());
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Reference in a new issue