Fix infinite loop in batching background jobs example
What does this MR do and why?
This MR corrects a logic flaw in the Batching in background jobs documentation code examples. Previously, the "continued background jobs" examples passed the initial iid (start cursor) to the rescheduled job instead of the correctly calculated max_iid (current batch end). This would cause the next job to restart from the beginning of the previous batch, leading to an infinite cycle of processing the same records.
This change updates MyJob.perform_in(2.minutes, project_id, iid) to MyJob.perform_in(2.minutes, project_id, max_iid) to ensure the cursor is properly advanced.
Relates to: #585001
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Checkout the branch
docs/fix-background-job-batching-example. - Open doc/development/database/batching_best_practices.md.
- Navigate to the "Batching in background jobs" section.
- Verify that in the code snippets under "Batching in background jobs", the
MyJob.perform_incall now usesmax_iidas the third argument. - (Optional) If you have GDK running, visit the docs page locally to verify rendering.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.