summaryrefslogtreecommitdiff
path: root/devel/management/commands
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-11-16 13:02:35 -0600
committerDan McGee <dan@archlinux.org>2011-11-16 13:02:35 -0600
commitaa20c798ca8af365b2549591700e932a74d068b8 (patch)
treebb399290e3f77561f00f2ddea2c340512b4b8845 /devel/management/commands
parentb1e406d73844d5a30344ca8ac855fe850c52bc2f (diff)
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 <dan@archlinux.org>
Diffstat (limited to 'devel/management/commands')
-rwxr-xr-xdevel/management/commands/reporead_inotify.py6
1 files changed, 6 insertions, 0 deletions
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