From 98d78d9a2e548a5f881b995b2701a1c2d51194b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Fri, 16 Oct 2015 16:58:53 +0200 Subject: [PATCH] Another consinstence fix in case of db connection failure --- server/src/uds/core/jobs/DelayedTaskRunner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/uds/core/jobs/DelayedTaskRunner.py b/server/src/uds/core/jobs/DelayedTaskRunner.py index 33bc9ae5..f3d5c322 100644 --- a/server/src/uds/core/jobs/DelayedTaskRunner.py +++ b/server/src/uds/core/jobs/DelayedTaskRunner.py @@ -44,7 +44,7 @@ import threading import time import logging -__updated__ = '2015-10-15' +__updated__ = '2015-10-16' logger = logging.getLogger(__name__) @@ -141,6 +141,10 @@ class DelayedTaskRunner(object): break except Exception, e: logger.info('Exception inserting a delayed task {0}: {1}'.format(str(e.__class__), e)) + try: + connection.close() + except Exception: + logger.exception('Closing db connection at insert') time.sleep(1) # Wait a bit before next try... # If retries == 0, this is a big error if retries == 0: