From d3b36e1ce992a8b70f4fe8fe9e8df74e835fb865 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 15 Nov 2011 22:03:01 -0600 Subject: reporead_inotify: cancel threads that haven't started yet on shutdown Signed-off-by: Dan McGee --- devel/management/commands/reporead_inotify.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devel/management/commands/reporead_inotify.py b/devel/management/commands/reporead_inotify.py index 135c036..4c865ce 100755 --- a/devel/management/commands/reporead_inotify.py +++ b/devel/management/commands/reporead_inotify.py @@ -54,6 +54,11 @@ class Command(BaseCommand): logger.info('Entering notifier loop') notifier.loop() + logger.info('Cancelling remaining threads...') + for thread in threading.enumerate(): + if hasattr(thread, 'cancel'): + thread.cancel() + def setup_notifier(self): '''Set up and configure the inotify machinery and logic. This takes the provided or default path_template and builds a list of -- cgit v1.2.3-24-g4f1b