#268 Rework database connections system
Merged by puiterwijk. Opened by puiterwijk.
puiterwijk/ipsilon db-connections  into  master

Download 268.patch

This new system will make sure that connections are closed (returned to the sqlalchemy pool) as soon as a specific query block is finished, rather than at the end of the full request.
This makes sure that even with a lot of modules enabled, we don't have lots of open database connections during a single request.

It might be good to do something here if self._trans is not None, like raise an error, or abort the transaction, or both?

Looks good to me, though I might suggest using an off the shelf connection manager rather than using a home made one. That would be a suggestion for another pull request of course, since this code already uses a home made one anyway.

We use the sqlalchemy built-in connection manager. "close"ing a connection just returns it back to the SA pool.

LGTM. I tend to do "with blah() as foo:" myself, but no objection to your style.

Commit 7f2f44fd fixes this pull-request

Pull-Request has been merged by puiterwijk@redhat.com

Metadata