WAIT FOR EVENT — Have Slonik script wait for previous event to complete
WAIT FOR EVENT (options);
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.
Not all events return interesting results. For instance, many people have run afoul of problems with SUBSCRIBE SET, when subscribing a new set. Be aware (and beware!) that a SUBSCRIBE SET request will return the event confirmation almost immediately, even though there might be several hours of work to do before the subscription is ready.
There is no reliable way, at present, to monitor from within a slonik script that SUBSCRIBE SET is complete.