job.start() and job.run() don't return #108
-
|
I found diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs
index d864767..b56c03f 100644
--- a/examples/basic/src/main.rs
+++ b/examples/basic/src/main.rs
@@ -50,7 +50,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?;
// Start the worker to process tasks.
- job.run().await?;
+ let handle = job.run().await?;
+
+ dbg!(handle);
Ok(())
}❯ cargo run
Running `target/debug/example-basic`
Sending welcome email to Ferris <ferris@example.com> (user_id: 42)And it just won't complete and paused there. Is it by design or did I miss something? |
Beta Was this translation helpful? Give feedback.
Answered by
maxcountryman
Dec 23, 2025
Replies: 1 comment 1 reply
-
|
Both Take a look at how the graceful shutdown example handles this. There's various ways you might design your program, including running jobs in a separate process, so underway lets you decide how you want to do this. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
chungwong
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both
startandrunbehave differently:startreturns a non-blocking handle which can be awaited,runwill block.Take a look at how the graceful shutdown example handles this.
There's various ways you might design your program, including running jobs in a separate process, so underway lets you decide how you want to do this.