gliff-ai / store

gliff.ai STORE – django application running gliff.ai’s main API and passing to the etebase API
https://gliff.ai
1 stars 0 forks source link

fix: set CONN_MAX_AGE to None #234

Closed philipjackson closed 2 years ago

philipjackson commented 2 years ago

Description

By default, django makes a new SQL connection for every database query it makes. This is a legacy thing; django 2 had to be this way, but we're on django 4 now. Setting CONN_MAX_AGE to None keeps the database connection open indefinitely, and this reduces query times from 0.5-0.7s to 0.02s. We should probably set it to something other than None in the future though, to prevent dead connections from piling up.

Checklist:

Put an x in the boxes that apply to this pull request (you can also fill these out after opening the pull request). If you're unsure about any of these, don't hesitate to leave a comment on this pull request!