Await¶
Name | - | Description | Default | Type |
---|---|---|---|---|
<input> |
Must match the input types of the first shard in the sequence. | Any |
||
<output> |
Will match the output types of the first shard of the sequence. | Any |
||
Shards |
The shards to activate. | None |
Shard [Shard] |
Executes a shard or a sequence of shards asynchronously and awaits their completion.
Details¶
(Await)
runs its shards (or sequence of shards) as a separate task that is sent directly to the thread pool, while the rest of the program continues executing (via other scheduled threads). Once this (Await)
task thread completes its execution the result of the execution of these inner shards is made available to the program.
This is called asynchronous computation and is used to prevent resource intensive processing (like downloading a large file data from an http server) from holding up the execution of the rest of the program.
Note
(Await)
has an alias (||)
which is more convenient to use. ||
also removes the need to use (->)
as, unlike (Await)
, it doesn't require the parameter shards to be grouped together.
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
[info] [my-wire] Message 3
[info] [await-wire] Message 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
[info] [my-wire] Message 3
[info] [await-wire] Message 1