From c66f0b74edf391a146f39f84ecf99c1a6e204443 Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Tue, 16 Feb 2016 11:29:43 +0100 Subject: [PATCH] Closes all db connections on worker recycle --- django_q/cluster.py | 1 + 1 file changed, 1 insertion(+) diff --git a/django_q/cluster.py b/django_q/cluster.py index da7c35a..0b853ed 100644 --- a/django_q/cluster.py +++ b/django_q/cluster.py @@ -388,6 +388,7 @@ def worker(task_queue, result_queue, timer, timeout=Conf.TIMEOUT): timer.value = -1 # Idle # Recycle if task_count == Conf.RECYCLE: + db.connections.close_all() # Close any active connections timer.value = -2 # Recycled break logger.info(_('{} stopped doing work').format(name))