update tokio-example

This commit is contained in:
asonix 2024-01-14 12:48:56 -05:00
parent c01a3544bc
commit eff0956740

View file

@ -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(())
} }