From aa20c798ca8af365b2549591700e932a74d068b8 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 16 Nov 2011 13:02:35 -0600 Subject: reporead_inotify: close connection once we are done with it This prevents an otherwise idle connection from sitting around and being totally useless. Signed-off-by: Dan McGee --- devel/management/commands/reporead_inotify.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devel/management/commands/reporead_inotify.py b/devel/management/commands/reporead_inotify.py index ffd49b8f..acb53a54 100755 --- a/devel/management/commands/reporead_inotify.py +++ b/devel/management/commands/reporead_inotify.py @@ -23,6 +23,7 @@ import threading import time from django.core.management.base import BaseCommand, CommandError +from django.db import connection from main.models import Arch, Repo from .reporead import read_repo @@ -90,6 +91,11 @@ class Command(BaseCommand): raise CommandError('path template did not uniquely ' 'determine architecture for each file') + # this thread is done using the database; all future access is done in + # the spawned read_repo() processes, so close the otherwise completely + # idle connection. + connection.close() + # A proper atomic replacement of the database as done by rsync is type # IN_MOVED_TO. repo-add/remove will finish with a IN_CLOSE_WRITE. mask = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_MOVED_TO -- cgit v1.2.3-55-g3dc8