Batch
Performs a bunch of commands concurrently with no ordering guarantees about the results. UseBatch to return several commands.
Variable number of commands to execute concurrently. Nil commands are automatically filtered out.
Returns
Returns aCmd that, when executed, runs all provided commands concurrently.
Example
Sequence
Runs the given commands one at a time, in order. Contrast this withBatch, which runs commands concurrently.
Variable number of commands to execute sequentially. Nil commands are automatically filtered out.
Returns
Returns aCmd that, when executed, runs all provided commands in order.
Example
BatchMsg
A message type used to perform a bunch of commands concurrently with no ordering guarantees. You can send aBatchMsg with Batch.
Example
Batch vs Sequence
When to use Batch
- Commands are independent and can run in any order
- You want maximum performance through parallel execution
- Order of message delivery doesn’t matter
When to use Sequence
- Commands have dependencies on previous results
- Order of execution matters
- You need predictable, sequential behavior