## Name

WAIT FOR EVENT — Have Slonik script wait for previous event to complete

## Synopsis

`WAIT FOR EVENT (options);`

## Description

Waits for event Confirmation.

Slonik remembers the last event generated on every node during script execution (events generated by earlier calls are currently not checked). In certain situations it is necessary that events generated on one node (such as `CREATE SET`) are processed on another node before issuing more commands (for instance, SUBSCRIBE SET). `WAIT FOR EVENT` may be used to cause the slonik script to wait until the subscriber node is ready for the next action.

`WAIT FOR EVENT` must be called outside of any `try` block in order to work, since new confirm messages don't become visible within a transaction.

`ORIGIN = ival | ALL`

  The origin of the event(s) to wait for.

`CONFIRMED = ival | ALL`

  The node ID of the receiver that must confirm the event(s).

`WAIT ON = ival`

  The ID of the node where the sl_confirm table is to be checked. The default value is 1.

`TIMEOUT = ival`

  The number of seconds to wait. Default is 600 (10 minutes). `TIMEOUT = 0` causes the script to wait indefinitely.

## Example

    WAIT FOR EVENT (
      ORIGIN = ALL,
      CONFIRMED = ALL,
      WAIT ON = 1
    );