Phuks-co / throat

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

Recommend setting autorollback for Postgres in example config #146

Closed happy-river closed 4 years ago

happy-river commented 4 years ago

We noticed that sometimes errors arising from database transactions were killing other database transactions with the error message "DatabaseError: current transaction is aborted, commands ignored until end of transaction block". This happens because Postgres wants you to roll back queries with serious errors before doing anything else. Peewee can do this automatically if autorollback is set in the database config.

happy-river commented 4 years ago

I added another commit to remove the recommendation to set autocommit for Postgres, because I found the following deprecation warning in the peewee source code:

DeprecationWarning: Peewee no longer uses the "autocommit" option, as the semantics now require it to always be True. Because some database-drivers also use the "autocommit" parameter, you are receiving a warning so you may update your code and remove the parameter, as in the future, specifying autocommit could impact the behavior of the database driver you are using.

Polsaker commented 4 years ago

Just found out that we use autorollback in prod too. Dunno why I never added it to the config before