You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 through always or after. 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?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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