From 33c6dd965655fdb2468ff2c2b8efaf1bc9bc3014 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 2 Sep 2018 10:45:06 -0700 Subject: [PATCH] fixed broken connection in scheduler, thanks Bart --- gluon/scheduler.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gluon/scheduler.py b/gluon/scheduler.py index 05567592..2343ffe6 100644 --- a/gluon/scheduler.py +++ b/gluon/scheduler.py @@ -1156,6 +1156,15 @@ class Scheduler(MetaScheduler): - does "housecleaning" for dead workers - triggers tasks assignment to workers """ + if self.db_thread: + # BKR 20180612 check if connection still works + try: + query = self.db_thread.scheduler_worker.worker_name == self.worker_name + self.db_thread(query).count() + except self.db_thread._adapter.connection.OperationalError: + # if not -> throw away self.db_thread and force reconnect + self.db_thread = None + if not self.db_thread: logger.debug('thread building own DAL object') self.db_thread = DAL(