Closed adamzapasnik closed 1 month ago
throw(:abort)
should do the trick: https://github.com/Shopify/job-iteration/blob/ae5828f1ecfaa45555593b4694dffb699629e7fd/lib/job-iteration/iteration.rb#L155-L157
ThrottleEnumerator uses it for example, and throwing abort without additional data is unit tested.
I see @bdewater it's very simple, thanks. Does it make sense to document this, cause it's a bit hidden and even obscure if someone doesn't know of throw
and catch
- which are rarely used 🤔
I think, PR is welcome.
I tried to find it in the docs but couldn't.
Let's say you have a job that iterates over N elements and midway you decided that you don't want to iterate over the remaining items and want to exit the job successfully (without retries). How to achieve this, I couldn't find it in the docs but it seems like someone must have already faced this problem before.