ReQL command: wait
Command syntax
table.wait([{:wait_for => 'all_replicas_ready', :timeout => <sec>}]) → object database.wait([{:wait_for => 'all_replicas_ready', :timeout => <sec>}]) → object r.wait(table | database, [{:wait_for => 'all_replicas_ready', :timeout => <sec>}]) → object
Description
Wait for a table (or tables) to be ready. A table may be temporarily unavailable after creation, rebalancing or reconfiguring.
The wait
command takes two optional arguments:
-
wait_for
: a string indicating a table status to wait on before returning, one ofready_for_outdated_reads
,ready_for_reads
,ready_for_writes
, orall_replicas_ready
. The default isall_replicas_ready
. -
timeout
: a number indicating maximum time, in seconds, to wait for the table to be ready. If this value is exceeded, aReqlRuntimeError
will be thrown. A value of0
means no timeout. The default is0
(no timeout).
The return value is an object consisting of a single field, ready
. The value is an integer indicating the number of tables waited for. It will always be 1
when wait
is called on a table, and the total number of tables when called on a database.
Versions of RethinkDB prior to 2.3 allowed
wait
to be called without a table or database specified. This is no longer valid;wait
requires explicit selection of a database or table.
Example: Wait on a table to be ready.
> r.table('superheroes').wait().run(conn)
{:ready => 1}
© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/ruby/wait/