Sep 19, 20201 min read
1.1.0: Add Readiness state
Changes:
- Add a new
Ready()method to the mainStateinterface. It returns a channel that is closed once all background jobs are ready. If the tree contains no states that support readiness, the channel is closed automatically after the tree has been traversed. - Add a new
WithReadinessstate initializer. It returns a newStateand aReadinessTailinterface.
TheReadinessTailshould remain owned by the background job associated with the createdState, as it carries the readiness signal.ReadinessTailhas a single method -Ok(). It signals that the background job is ready. IfOk()is never called, readiness will remain blocked for all parent states, and the channel returned byState.Ready()will never be closed.
Did you enjoy this article?
Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.