Is there a way to set a timeout in psycopg2 for db transactions or for db queries?
A sample use-case:
Heroku limits django web requests to 30sec
Looks like PostgreSQL 9.6 added idle transaction timeouts. See:
PostgreSQL 9.6 is also supported in Heroku so you should be able to use this.