Documentation issue with Pessimistic Disconnect Handler Example
The example documented here: http://docs.sqlalchemy.org/en/latest/core/pooling.html#disconnect-handling-pessimistic has an issue in that it doesn't account for the connection.should_close_with_result status. If this is set it means that the select() will close the connection, causing the original request to work on a closed connection and failing. My trivial fix was to stash the state, set it to false, and then resolve after doing the select 1.
Comments (4)
-
repo owner -
repo owner - changed status to resolved
Add close_with_result to pessimistic connection example
For connectionless execution, the recipe here will fail unless the should_close_with_result flag is temporarily set to False.
Change-Id: Ib77b4439e8361b24478108c413b1ba720a68350f Fixes:
#3712→ <<cset 7f08d8c93af1>>
-
repo owner Add close_with_result to pessimistic connection example
For connectionless execution, the recipe here will fail unless the should_close_with_result flag is temporarily set to False.
Change-Id: Ib77b4439e8361b24478108c413b1ba720a68350f Fixes:
#3712(cherry picked from commit 7f08d8c93af1b574d1cc11af38baf26d9d59058f)→ <<cset c55ad9691900>>
-
reporter nice, looks exactly like my solution.
- Log in to comment
this is part of the downstream version of this, I had omitted it to make the example easier to read. but it probably is better to have it here.