Skip to content

Commit

Permalink
Explain exceptions inside each_iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeinerz authored Oct 18, 2023
1 parent 25cab28 commit 79f5b5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions guides/iteration-how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ SELECT `products`.* FROM `products` ORDER BY products.id LIMIT 100
```sql
SELECT `products`.* FROM `products` WHERE (products.id > 2) ORDER BY products.id LIMIT 100
```
## Exceptions inside `each_iteration`

When an unrescued exception happens inside the `each_iteration` block, the job will stop and re-enqueue itself with the last successful cursor. This means that the iteration that failed will be retried with the same parameters and the cursor will only move if that iteration succeeds. This behaviour may be enough for intermittent errors, such as network connection failures, but if your execution is deterministic and you have an error, subsequent iterations will never run.

In other words, if you are trying to process 100 records but you have a problem with the 61st, only the first 60 will be processed.

## Signals

Expand Down

0 comments on commit 79f5b5c

Please sign in to comment.