diff --git a/freepost/database.py b/freepost/database.py index c0ab7f9..bedc247 100644 --- a/freepost/database.py +++ b/freepost/database.py @@ -10,6 +10,10 @@ db = MySQLdb.connect ( passwd = settings['mysql']['password'], autocommit = True) +# Since the "db" object is reused for the entire life of website, +# this ping should avoid MySQL timing out if no requests are sent in a while. +db.ping (True) + # Store a new session_id for a user that has logged in # The session token is stored in the user cookies during login, here # we store the hash value of that token.