Await¶
Name | Mandatory | 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 |
No | The shards to activate. | none |
Shard [Shard] None |
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 is best used for shards that will take a long time to complete their tasks. Shards like FS.Read
and FS.Write
are good candidates to be wrapped in Await
.
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
[info] [await-wire] Message 1
[info] [await-wire] Message 2
[info] [my-wire] Message 3