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
if we assign an internal commit id to each state model we can provide validation that the candidate commit state model is up to date with myosin's internal state model and will not overwrite any properties unintentionally. This can happen in a multithreaded environment where the checked out copy of the state model is out of date with the current copy:
Consider this example which does not use the state lock properly:
In a multithreaded environment where Model is being updated elsewhere the commit statement here will overwrite all recent property changes except for the property value. The way to solve this of course is to keep all checkout and commit operations within the same state lock session:
This can be solved using a private __context__ hash property which is set by the state context on checkout. Before a commit is made the__context__ hash of the commit instance can be checked against the current instance __context__ to ensure the model is from a checkout within this context.
if we assign an internal commit id to each state model we can provide validation that the candidate commit state model is up to date with myosin's internal state model and will not overwrite any properties unintentionally. This can happen in a multithreaded environment where the checked out copy of the state model is out of date with the current copy:
Consider this example which does not use the state lock properly:
In a multithreaded environment where
Model
is being updated elsewhere the commit statement here will overwrite all recent property changes except for theproperty
value. The way to solve this of course is to keep all checkout and commit operations within the same state lock session:But to an end developer debugging their application having some internal detection and logging messages may help them identify this mistake.
The text was updated successfully, but these errors were encountered: