Closed rgov closed 2 years ago
Hi @rgov and @aleneum, was this feature ever merged into the main branch? I noticed that there's no workaround currently because setting a timeout and going back to your original state doesn't work.
It is on the dev-0.9 branch, which is not yet merged into main.
Note: This involved a bit of in-browser coding, so please check for formatting issues and bugs.
This change introduces a Retry mix-in which lets you limit the number of times a state may be re-entered from itself. This is useful if a state represents an operation that may need to be retried a few times, but should eventually give up.
This works really well with the Timeout mix-in:
In this example, the
PingServer
state might involve sending aping
packet to a server and expecting apong
reply, whereupon it will transition to another state. If the timeout is met, then it would re-enter thePingServer
state, triggering a secondping
to be sent. But on the 5th time the state is entered, it will instead transition toCriticalFailure
without sending anotherping
.