# Wait / Joiner task

This task does two things that both mean "do not go on yet":

- **Wait**: hold the path for a time, or until a condition is true.
- **Join**: hold the path until the other branches of the job have arrived, and go on with their lists made into one.

One task can do both: it waits first, then joins.

## Wait

| Field | What it does | On a new task |
|---|---|---|
| **Wait** | how long, and the unit: **Milliseconds**, **Seconds**, **Minutes**, **Hours**, **Days**. May hold a variable. | 0 |
| **Until the following condition is true** | with it, the time is the **longest** wait: the path goes on as soon as the condition is true, and the task **fails** if it is not true when the time is over | off |
| the first value, the comparison, the second value | the condition. "Leave both fields blank to always be a true condition." | |

The condition is looked at ten times a second, with the values worked out afresh each time. So it can wait for something that another branch, or the clock, changes:

| Wait | Condition | Means |
|---|---|---|
| `30` Seconds | none | pause half a minute, for a partner's server that needs a breath between two logins |
| `2` Hours | `{HH}:{mm}:{ss}` **Greater than datetime** `18:00:00` | go on at six in the evening, or fail if that is more than two hours away |
| `10` Minutes | `{ready}` **Equals** `yes` | go on when another branch has set the variable |

The comparisons are those of [Conditions on a task](Jobs-Conditions.md#comparisons). The two date comparisons exist only here; they read `MM/dd/yyyy HH:mm:ss`, `MM/dd/yyyy` or `HH:mm:ss`. Pattern comparisons here do not tell capitals from small letters.

When the time ran out: "Condition not met in specified time period", and the task's red line is taken.

A waiting run counts as running. It keeps its place on the [engine](Jobs-Engines.md), and it can be stopped while it waits.

## Join branches

| Field | What it does | On a new task |
|---|---|---|
| **Join the branches that can still reach this task, then go on with their merged items** | makes the task a joiner | off |
| **Merge** | how the lists become one: see below | Union |
| **Timeout** | the longest wait for branches, in **Seconds**, **Minutes** or **Hours**. Empty: as long as it takes. | empty |
| **At the timeout** | **Fail (take the failure line)**, or **Go on with the branches that arrived** | Fail |
| **When a joined branch failed** | **Go on**, or **Fail (take the failure line)** | Go on |

| Merge | The list that goes on |
|---|---|
| **Union: every item once** | all items of all branches; an item that several branches bring is there once |
| **Intersection: only items every branch kept** | the items that are in every branch's list. An item one branch excluded, or failed on, is out. |
| **Keep all: every branch's items, duplicates too** | the lists one behind the other |

> The branch with the lowest dot goes on with the merged list. Two entries with the same URL are one item; the lowest dot's values win.

### What a joiner waits for

Not for a fixed number of branches, but for every branch that **can still get here**. A branch that ended elsewhere, at End or at a failed task without a failure line, is not waited for. A branch that is still working somewhere from where a line leads here is.

So a joiner never hangs on a branch that will not come, and it needs no setting for how many to expect. A task without branches before it simply goes on: "No branches to join here; continuing."

### Uses

| To | Use |
|---|---|
| send one mail after three deliveries | **Union**, then the Email |
| go on only with files that reached every destination | **Intersection** |
| collect what several Finds found | **Keep all**, or **Union** to drop doubles |
| not wait for ever for a slow partner | **Timeout** 30 Minutes, **Go on with the branches that arrived** |
| treat one failed delivery as a failure of all | **When a joined branch failed**: Fail |

## What it hands on

Without the join: the items it was given. With it: the merged list.

## Things to know

- **A joiner after a [Jump](Task-Jump.md)** joins the true and the false path as it joins branches.
- **After a restart** of the server or the engine, a joiner that had already let its list through does so again without waiting a second time.
- **Waiting costs nothing but time**, but a run that waits holds its room on the engine. For waits of hours, end the job and let a schedule start the next step.
- **To stop a run at a point until a person lets it go on**, use a [breakpoint](Jobs-Breakpoints.md), not a long wait.
