fixed broken connection in scheduler, thanks Bart

This commit is contained in:
mdipierro
2018-09-02 10:45:06 -07:00
parent 1c8790271d
commit 33c6dd9656
+9
View File
@@ -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(