celery / jumpstarter

MIT License
7 stars 3 forks source link

Store the model in the state machine as a weakref #36

Open thedrow opened 3 years ago

thedrow commented 3 years ago

We no longer leak memory as the state machine's model is stored by a weak reference. When the actor goes out of scope, the model is removed by the weakref's finalizer. This took some doing and I'm hoping transitions could support this usecase more easily in the future.

As a side effect, state machine inheritance is now faster as none of the models are deepcopied into the newly created state machine. This should have been the case in the first place, however with this patch it is crucial since attempting to deepcopy an empty weakref results in a ReferenceError.

ghost commented 3 years ago

DeepCode failed to analyze this pull request

Something went wrong despite trying multiple times, sorry about that. Please comment this pull request with "Retry DeepCode" to manually retry, or contact us so that a human can look into the issue.