Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Teardown app context vs. request context #99

Closed
alexex opened this Issue · 1 comment

3 participants

@alexex

According to L672 flask-sqlalchemy uses teardown_appcontext if available and not teardown_requestcontext. I would actually like to know what thought was behind this, as the sqlalchemy docs suggest to close/remove/rollback the session after every request (see http://docs.sqlalchemy.org/en/rel_0_7/orm/session.html#lifespan-of-a-contextual-session).

In my opinion this can lead to problems with pool_recycle as not all connections are always returned to the pool (at least my sqlalchemy log looked like it) and so the pool won't be recycled. But I might be wrong.

@mgax

When handling a request, the app context has a similar lifecycle to the request context, so tying the session to the app context makes sense.

@immunda immunda closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.