Promise.all. This page shows how Nelkap finds each one again, and how to handle jobs too big for a single run.
Steps in a loop
Each step in a loop is saved on its own. An import that stops halfway goes on from the last batch that made it:step.run('send') works, but a name that says which item it handles, like batch 3, is easier to read on the run’s page.
Steps side by side
Steps can run at the same time. Start them together and wait for all of them:Steps in conditions
A step can sit behind anif, as long as the condition takes the same path on every call. Base it on the payload or on the result of an earlier step, never on something that can change between calls, like the time:
Stay under 100 steps
A run holds up to 100 steps of every kind, and 32 MB of saved steps in all. A run that goes over fails withstepLimitReached. Two ways keep big jobs under the limit:
- Put several items in each step. A step that imports 500 rows counts once.
- Split the job across runs, as below.
Split a job across runs
For a job of any size, give each part its own run. A first workflow lists the parts and starts a run for each one, then each run does its part:importBatch a concurrency limit to control how many batches go at once.
The first workflow still counts one step per batch. For more batches than one run can start, add a level: the first workflow starts a run per chunk of batches, and each of those starts a run per batch.
The first run ends once it has started every batch, without waiting for them. To act when the last batch is done, count the batches done in your database, as the large import example does.