-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes junk is left in the transaction when #returning #143
Comments
Actually fixing this is a little more difficult than just slapping a For instance:
By putting the cleanup code in a finally block, you end up with compiled source which looks like this:
Simplifying the problem from the above code:
Will return So somehow the finally block would both need to know whether or not the function has returned / excepted naturally and make a decision based on that. I assume some extra code would need to be added when |
At the start of every Cheetah method, if there's no running transaction, Cheetah will create a dummy one and assign it to self.transaction. At the end of the method, if self.transaction is a dummy, Cheetah will set it back to None.
All is well and good, unless the method happens to use
#return
, in which case the cleanup code never runs. The cleanup should be in a finally block, instead.Upshot of this problem:
That anonymous object is actually the
NO_CONTENT
sentinel that Cheetah returns when it thinks it's being called within a transaction.The fix is to clean up the transaction in a finally block.
The text was updated successfully, but these errors were encountered: