altairbow / django-db-connection-pool

Database connection pool component library for Django
https://pypi.python.org/pypi/django-db-connection-pool/
MIT License
181 stars 24 forks source link

Support Pool Recycling #24

Closed grippy closed 2 years ago

grippy commented 2 years ago

Reading the SQLAlchemy docs, there's a setting to support automatic pool recycling.

From the Docs: https://docs.sqlalchemy.org/en/14/core/pooling.html#setting-pool-recycle

from sqlalchemy import create_engine
e = create_engine("mysql://scott:tiger@localhost/test", pool_recycle=3600)
grippy commented 2 years ago

Oh, I just discovered this default config value: https://github.com/altairbow/django-db-connection-pool/blob/master/dj_db_conn_pool/core/__init__.py#L17

Which is applied here: https://github.com/altairbow/django-db-connection-pool/blob/master/dj_db_conn_pool/core/mixins.py#L64-L70

👍 Looks like it already support pool recycling. Adding a minor example on the README would be helpful. I'll open a PR.