I usually do it like this: I separate the API call or data fetching into its own workflow. In this example, it’s the same workflow. In this simple workflow, I would also implement things like the number of retry attempts and fallback logic. The larger workflow can then process one item after the other. The advantage is that it’s easy to swap out the workflow if, for example, the API is changed to another one.
Personally, I always use the success output data / error output data to clearly define the end of the workflow. But that’s just a matter of personal preference.
{{ ($('Loop Over Items').context.currentRunIndex + 1) % 5 }}
This can be done using context.currentRunIndex. However, please also remove the reset from the “Loop Over Items” node; otherwise, it will always start over from the beginning, and the run index will not continue counting forward.
I’ve updated my test workflow and implemented some debugging console.log().
It seems the loop is never completed: it only processed 11 items and never reacher the done step in the Loop Over Items node: any idea about the reason?
Mmm… do you have a self-hosted instance or a cloud one? Maybe there is some sort of configuration for test workflows? (I’m using a self-hosted instance)