Method
MySQLiAwaiter::await
Suspends the calling coroutine until the connection's asynchronous query has finished.
Description#
public static MySQLiAwaiter::await(
mysqli $connection,
?float $timeout = null
): mysqliThe result is not taken here: reap_async_query() after this returns, as mysqli's own
asynchronous API requires. What a query that fails throws is mysqli's decision, made there.
See the class docblock for what one coroutine at a time means, and for a wait that ends early.
Parameters#
- $connection mysqli
- The MySQLi connection whose query is awaited
- $timeout ?float = null
- The most seconds to wait for the query to complete; null, the default, waits for as long as it takes
Return values#
The connection that has a result to reap mysqli
Errors / Exceptions#
| Exception | When |
|---|---|
LogicException | Outside a coroutine, or when another coroutine is awaiting this connection already |
phasync\TimeoutException | When $timeout runs out, leaving the query in flight |
RuntimeException | If the service waiting for the query ended without it, or the connection was closed while it was waited for |