Great article! Thanks! We had the same problem using supervisor that is running a snippet that was receiving stock data from a streaming api and storing it in database. Every night the connection to the database server was dropped when the streaming api was no longer sending data until stock exchange opened in the early morning. With this fix everything seems to be working fine now.