From cb3189e944e196764c7e4a8ed6ff442621d8e485 Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Mon, 14 Sep 2015 09:00:55 -0400 Subject: [PATCH] always try to close the connection before reconnecting. --- poller-service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/poller-service.py b/poller-service.py index fff7968d7..93efcd725 100755 --- a/poller-service.py +++ b/poller-service.py @@ -54,6 +54,11 @@ class DB: def connect(self): while True: + try: + self.conn.close() + except: + pass + try: if db_port == 0: self.conn = MySQLdb.connect(host=db_server, user=db_username, passwd=db_password, db=db_dbname)