From 7150090e93a54fd7dbcde3c4b585925bc59c873b Mon Sep 17 00:00:00 2001 From: Silvia Scalisi Date: Tue, 2 Oct 2018 15:01:42 +0200 Subject: [PATCH] close all connection before loading tasks --- django_leek/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django_leek/server.py b/django_leek/server.py index e6e6c62..fa4c4d0 100644 --- a/django_leek/server.py +++ b/django_leek/server.py @@ -5,6 +5,7 @@ from .helpers import load_task from . import worker from . import helpers +import django log = logging.getLogger(__name__) @@ -41,6 +42,7 @@ def handle(self): log.info('Got a task') try: task_id = int(data.decode()) + django.db.connections.close_all() queued_task = load_task(task_id=task_id) # Ensure pool got a worker processing it