Skip to content

Commit d1a4190

Browse files
TuntiiCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f8e614c commit d1a4190

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/cookbook/src/learning/curriculum.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ This curriculum is designed to take you from a RustAPI beginner to an advanced u
151151
- **Task:**
152152
1. Implement a job that sends a "Welcome" email (simulated) when a user registers.
153153
2. Write an integration test using `TestClient` to verify the registration endpoint.
154-
- **Expected Output:** Registration returns 200 immediately; console logs show "Sending email..." shortly after. Tests pass.
154+
- **Expected Output:** Registration returns 200 immediately; console logs show "Sending welcome email to ..." shortly after. Tests pass.
155155
- **Pitfalls:** Forgetting to start the job worker loop.
156156

157157
#### 🧠 Knowledge Check

docs/cookbook/src/recipes/background_jobs.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ A job consists of a data structure (the payload) and an implementation of the `J
2323
use rustapi_jobs::{Job, JobContext, Result};
2424
use serde::{Deserialize, Serialize};
2525
use async_trait::async_trait;
26-
use std::fmt::Debug;
26+
2727
2828
// 1. Define the job payload
2929
#[derive(Debug, Serialize, Deserialize, Clone)]
@@ -140,9 +140,10 @@ struct RegisterRequest {
140140

141141
`rustapi-jobs` handles failures automatically. If your `execute` method returns an `Err`, the job will be:
142142
1. Marked as failed.
143-
2. Scheduled for retry with **exponential backoff**.
144-
3. Retried up to `max_attempts` (default is configurable per enqueue).
143+
2. Optionally scheduled for retry with **exponential backoff** if retries are enabled.
144+
3. Retried up to `max_attempts` when you configure it via `EnqueueOptions`.
145145

146+
By default, `EnqueueOptions::new()` sets `max_attempts` to `0`, so a failed job will **not** be retried unless you explicitly opt in by calling `.max_attempts(...)` with a value greater than the current `attempts` count.
146147
To customize retry behavior, use `enqueue_opts`:
147148

148149
```rust,no_run

0 commit comments

Comments
 (0)