Promise.all. On each call, the SDK matches them with their saved results in the order your code reaches them. This page shows how to write each case, and how to split jobs too big for a single run.
Loops
Each step in a loop is saved on its own. An import cut off halfway resumes at the first batch with no saved result:nelkap/workflows/import-contacts.ts
Parallel steps
Steps can run at the same time. Start them together and wait for all of them: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:
Step limit
A run holds up to 100 steps, of every type, 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.
Fan-out
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:nelkap/workflows/import-file.ts
importBatch a concurrency limit to set how many batches run 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.