diff --git a/pandora/app/config.py b/pandora/app/config.py index 0e22156d..8de4fad4 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -21,6 +21,7 @@ from archive.extract import supported_formats, AVCONV _win = (sys.platform == "win32") RUN_RELOADER = True +NOTIFIER = None def get_version(): info = os.path.join(os.path.dirname(__file__), '..', '..', '.bzr/branch/last-revision') @@ -130,6 +131,7 @@ check the README for further details. def reloader_thread(): + global NOTIFIER settings.RELOADER_RUNNING=True _config_mtime = 0 try: @@ -149,6 +151,7 @@ def reloader_thread(): wm = pyinotify.WatchManager() add_watch() notifier = pyinotify.Notifier(wm) + NOTIFIER = notifier notifier.loop() else: while RUN_RELOADER: @@ -271,3 +274,13 @@ def init(): if not settings.RELOADER_RUNNING: load_config() thread.start_new_thread(reloader_thread, ()) + +def shutdown(): + if settings.RELOADER_RUNNING: + RUN_RELOADER = False + settings.RELOADER_RUNNING = False + if NOTIFIER: + NOTIFIER.stop() + + + diff --git a/pandora/manage.py b/pandora/manage.py index 0d7eb6f7..4a2d1a85 100755 --- a/pandora/manage.py +++ b/pandora/manage.py @@ -23,3 +23,5 @@ if __name__ == "__main__": sys.stderr.write("Error: Can't find '%s'.\nBefore you run pan.do/ra you must create it\n" % settings.SITE_CONFIG) sys.exit(1) execute_manager(settings) + import app.config + app.config.shutdown()