summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-11-16 20:02:35 +0100
committerDan McGee <dan@archlinux.org>2011-11-16 20:02:35 +0100
commitaa20c798ca8af365b2549591700e932a74d068b8 (patch)
treebb399290e3f77561f00f2ddea2c340512b4b8845
parentb1e406d73844d5a30344ca8ac855fe850c52bc2f (diff)
downloadarchweb-aa20c798ca8af365b2549591700e932a74d068b8.tar.gz
archweb-aa20c798ca8af365b2549591700e932a74d068b8.tar.xz
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>
-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 ffd49b8..acb53a5 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