heroku-python / django-postgrespool

[DEPRECATED] Use https://pypi.org/project/django-postgrespool2/ instead
MIT License
323 stars 66 forks source link

Pooling not working with Django 1.7 #23

Closed garrettheel closed 8 years ago

garrettheel commented 10 years ago

I followed all of the steps in the README to configure Django to use this library for pooling but when monitoring the connections I couldn't see the pooling behavior.

After some debugging, I couldn't see anywhere that was using db_pool to get connections so I patched base.py and overrode get_new_connection on DatabaseWrapper as follows:

def get_new_connection(self, conn_params):
        return db_pool.connect(**conn_params)

With this patch it seems the pooling is working as expected. I can see the connections being reused and the checkout|checkin|connect log messages that I couldn't before.

Has something changed in Django that could have broken this (I couldn't see anything with a quick look through history)?

thewayiam commented 9 years ago

Would you like to try databases setting: DATABASES['default']['CONN_MAX_AGE'] = None That solve my problem with Django 1.7.1, postgres 9.3.5

kennethreitz commented 8 years ago

Yes, this package is incompatible with CONN_MAX_AGE