How do you set the behavior of MySQL's automatic reconnection behavior in django?
I'm assuming this is a client side configuration, correct?
Django database wrappers have a method called is_usable()
that pings the server to check if it's up. This is the one for MySQL -
def is_usable(self):
try:
self.connection.ping()
except DatabaseError:
return False
else:
return True
From MySQL url you provided -
If auto-reconnect is enabled, mysql_ping() performs a reconnect. Otherwise, it returns an error.
So it all depends on how you configured this part -
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
which you have to set yourself on the DBMS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With