-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This refactors the scheduler to be more like the worker: e.g. it now manages a cancellation token and uses it to manage the shutdown state. Again similarly to the worker, it listens on the same shutdown channel and upon a notify from postgres will cancel its cancellation token thereby stopping the scheduler. Coupled with these changes is a breaking change to the queue interface: instead of taking ownership of input, enqueue takes a reference. A similar change should be made for the schedule methods, but that is left out of this patch intentionally.
- Loading branch information
1 parent
6127c9a
commit 6df1f0e
Showing
9 changed files
with
112 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |
|
||
// Enqueue a job task. | ||
let task_id = job | ||
.enqueue(WelcomeEmail { | ||
.enqueue(&WelcomeEmail { | ||
user_id: 42, | ||
email: "[email protected]".to_string(), | ||
name: "Ferris".to_string(), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |
|
||
// Enqueue a job task. | ||
let task_id = job | ||
.enqueue(WelcomeEmail { | ||
.enqueue(&WelcomeEmail { | ||
user_id: 42, | ||
email: "[email protected]".to_string(), | ||
name: "Ferris".to_string(), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ | |
//! .await?; | ||
//! | ||
//! // Here we enqueue a new job to be processed later. | ||
//! job.enqueue(WelcomeEmail { | ||
//! job.enqueue(&WelcomeEmail { | ||
//! user_id: 42, | ||
//! email: "[email protected]".to_string(), | ||
//! name: "Ferris".to_string(), | ||
|
@@ -161,7 +161,7 @@ | |
//! .await?; | ||
//! | ||
//! // Enqueue the job for the given order. | ||
//! job.enqueue(GenerateReceipt { order_id: 42 }).await?; | ||
//! job.enqueue(&GenerateReceipt { order_id: 42 }).await?; | ||
//! | ||
//! // Start processing enqueued jobs. | ||
//! job.start().await??; | ||
|
Oops, something went wrong.