Phuks-co / throat

Open Source link aggregator and discussion platform powering Phuks
https://phuks.co
MIT License
73 stars 32 forks source link

Explicitly manage database connections #155

Closed happy-river closed 4 years ago

happy-river commented 4 years ago

Fix a database connection leak which would happen while the application was under load. Peewee's documentation recommends managing database connections explicitly instead of using their autoconnect option, which defaults to True. Set autoconnect to False, and use the method recommended by the Flask documentation to manage connections.

See: http://docs.peewee-orm.com/en/latest/peewee/database.html?highlight=connection#using-autoconnect https://flask.palletsprojects.com/en/1.1.x/appcontext/