Replies: 2 comments
-
Yes, I have exactly this problem. In order to know when to serialise a long-running actor in a backend context, I need to distinguish when a machine actor is waiting for an external event vs waiting for a child actor to complete. |
Beta Was this translation helpful? Give feedback.
0 replies
-
The transition API that's coming up soon (#4954) may help with this, since it allows you to have full control over how your state machines run. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In our backend we have a machine that can go through several states based on a single triggering event, e.g.
waiting -> adding info -> ready for submission -> submitting -> submitted. Within the controller we basically only wait for the first transitions to happen (
waiting -> adding info -> ready for submission`) and the other transitions happen after the response has been sent.My concern is that since we never stop the actor (because
submitted
is not a final state and it could take weeks before the final state is hit) this will cause memory to increase. I think the solution would be to check whether the machine is 'settled', that is, there are no actors running and no automatic transitions going to happen throughalways
orafter
. In that case we could stop the machine and when a new event comes in, we just create a new machine and rehydrate it.Is this the right approach, and is there a way to check whether a machine is settled?
Beta Was this translation helpful? Give feedback.
All reactions