mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-21 19:40:59 +00:00
update tokio-example
This commit is contained in:
parent
c01a3544bc
commit
eff0956740
1 changed files with 3 additions and 1 deletions
|
@ -40,7 +40,7 @@ async fn main() -> Result<(), Error> {
|
||||||
let queue_handle = WorkerConfig::new(storage, |_| MyState::new("My App"))
|
let queue_handle = WorkerConfig::new(storage, |_| MyState::new("My App"))
|
||||||
.register::<MyJob>()
|
.register::<MyJob>()
|
||||||
.set_worker_count(DEFAULT_QUEUE, 16)
|
.set_worker_count(DEFAULT_QUEUE, 16)
|
||||||
.start();
|
.start()?;
|
||||||
|
|
||||||
// Queue our jobs
|
// Queue our jobs
|
||||||
queue_handle.queue(MyJob::new(1, 2)).await?;
|
queue_handle.queue(MyJob::new(1, 2)).await?;
|
||||||
|
@ -55,6 +55,8 @@ async fn main() -> Result<(), Error> {
|
||||||
// Block on Tokio
|
// Block on Tokio
|
||||||
tokio::signal::ctrl_c().await?;
|
tokio::signal::ctrl_c().await?;
|
||||||
|
|
||||||
|
drop(queue_handle);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue