-
Notifications
You must be signed in to change notification settings - Fork 887
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
add first class transaction manager support #2606
Comments
This doesn't help with "tm should be able to create request" but Mike and I talked about moving the code that calls the response/finished callbacks into a tween that would be autoincluded for the most part. That would allow a TM tween to wrap as much of the request lifecycle as the suggestion above would allow. |
I have a few random thoughts which may (or may not) be of interest:
Those two are handled by tweens in my system and should ideally be "outside" of the transaction retry logic. I really would prefer to not to put them in middleware. |
Hey @jinty thanks for commenting!
This should be fine but you would need to consider this on a per-exception basis. If you are just reading from the database then everything will just work because the original transaction is still open. The only time this is not the case is if the exception is from the database at which point you may need to abort the transaction and start a new one (which will be later aborted). IF you need to write to the database then you should abort/commit inside the exception view because the transaction manager will be configured to always abort upon exceptions. Alternatively if this is for error reporting you might consider using a database session that is not connected to the transaction manager (which is used for normal request operations).
I think this will need to be controlled by your logging handler. For example, pyramid_exclog can ignore certain types of exceptions.
Yep, we are not talking about middleware anymore I don't think. The transaction manager will be a tween. |
This issue in Pyramid should finally be sorted thanks to pyramid_retry + changes in pyramid_tm + #2964. |
The current story around transaction management is that it "80% works". There are some related issues:
The TLDR is that 1) retries are completely broken when cached state on the request is shared across transactions in RDBMS data managers and 2) the transaction manager is not capable of wrapping the entire lifecycle of the request. This is a fundamental problem with using tweens which are not capable of wrapping the entire request. Goals:
I'm proposing adding transaction manager support to the core of Pyramid, providing necessary hooks for pyramid_tm to do its job.
Possible API written off the cuff:
The text was updated successfully, but these errors were encountered: