guanquann / Stocksera

Finance application that provides more than 60 different alternative data to retail investors
MIT License
620 stars 103 forks source link

MYSQL interactive timeout #43

Closed CodeInFilth closed 1 year ago

CodeInFilth commented 1 year ago

Hey I am using nohup to have the server run and read the output logs. but after a few hours I am getting this error.

4031 (HY000): The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.

I have found solutions to fix this but was wondering how you keep your connections active on the main site. What do you use to keep your docker server running?

CodeInFilth commented 1 year ago

this is an issue with the mysql db connection

guanquann commented 1 year ago

It's because mysql db disconnect after a few hours if inactive. I have pushed a new commit, please refer to the latest one for more details. Basically, add cnx, cur, engine = connect_mysql_database() to the functions that calls the database to check if the connection is working