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

#585001

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Checkout the branch docs/fix-background-job-batching-example.
  2. Open doc/development/database/batching_best_practices.md.
  3. Navigate to the "Batching in background jobs" section.
  4. Verify that in the code snippets under "Batching in background jobs", the MyJob.perform_in call now uses max_iid as the third argument.
  5. (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.

Edited by tutumantutu

Merge request reports

Loading