From c822d3eb4d1fa539be45459d1698e786507a0e5b Mon Sep 17 00:00:00 2001 From: zPlus Date: Sun, 22 Jul 2018 09:42:14 +0200 Subject: [PATCH] Fix database timeout issue. modified: freepost/database.py --- freepost/database.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/freepost/database.py b/freepost/database.py index c0ab7f9c..bedc2478 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.