From 63d82ad7e7ee0b4e9e38dd8b36cfd9880208306b Mon Sep 17 00:00:00 2001 From: j Date: Sun, 27 Sep 2020 17:58:35 +0200 Subject: [PATCH] remove config reloader --- pandora/app/config.py | 57 ------------------- pandora/app/monkey_patch.py | 2 - .../commands/rebuild_documentfind.py | 1 - .../management/commands/sync_documentsort.py | 1 - pandora/item/management/commands/get_frame.py | 1 - .../management/commands/rebuild_filter.py | 1 - .../item/management/commands/rebuild_find.py | 1 - .../management/commands/rebuild_indexes.py | 1 - .../item/management/commands/rebuild_sort.py | 1 - .../item/management/commands/sqlfindindex.py | 1 - .../item/management/commands/sync_itemsort.py | 1 - pandora/manage.py | 2 - pandora/settings.py | 2 - 13 files changed, 72 deletions(-) diff --git a/pandora/app/config.py b/pandora/app/config.py index e950e5e90..631204f1f 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -24,9 +24,6 @@ User = get_user_model() _win = (sys.platform == "win32") -RUN_RELOADER = True -NOTIFIER = None - def get_version(): git_dir = join(dirname(dirname(dirname(__file__))), '.git') if exists(git_dir): @@ -258,45 +255,6 @@ check the README for further details. pass - -def reloader_thread(): - global NOTIFIER - settings.RELOADER_RUNNING=True - _config_mtime = 0 - try: - import pyinotify - INOTIFY = True - except: - INOTIFY = False - if INOTIFY: - def add_watch(): - name = os.path.realpath(settings.SITE_CONFIG) - wm.add_watch(name, pyinotify.IN_CLOSE_WRITE, reload_config) - - def reload_config(event): - load_config() - add_watch() - - wm = pyinotify.WatchManager() - add_watch() - notifier = pyinotify.Notifier(wm) - NOTIFIER = notifier - notifier.loop() - else: - while RUN_RELOADER: - try: - stat = os.stat(settings.SITE_CONFIG) - mtime = stat.st_mtime - if _win: - mtime -= stat.st_ctime - if mtime > _config_mtime: - load_config() - _config_mtime = mtime - time.sleep(10) - except: - #sys.stderr.write("reloading config failed\n") - pass - def update_static(): oxjs_build = os.path.join(settings.STATIC_ROOT, 'oxjs/tools/build/build.py') if os.path.exists(oxjs_build): @@ -406,18 +364,3 @@ def update_geoip(force=False): else: print('failed to download GeoLite2-City.mmdb') -def init(): - if not settings.RELOADER_RUNNING: - load_config(True) - if settings.RELOAD_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/app/monkey_patch.py b/pandora/app/monkey_patch.py index f4579d563..0bf0212d4 100644 --- a/pandora/app/monkey_patch.py +++ b/pandora/app/monkey_patch.py @@ -7,9 +7,7 @@ from django.core.validators import MaxLengthValidator User = get_user_model() -# load config from json from . import config -config.init() NEW_LENGTH = { 'username': 255, diff --git a/pandora/document/management/commands/rebuild_documentfind.py b/pandora/document/management/commands/rebuild_documentfind.py index af56b748c..157072c33 100644 --- a/pandora/document/management/commands/rebuild_documentfind.py +++ b/pandora/document/management/commands/rebuild_documentfind.py @@ -5,7 +5,6 @@ from django.db import connection, transaction from django.db.models import fields from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models diff --git a/pandora/document/management/commands/sync_documentsort.py b/pandora/document/management/commands/sync_documentsort.py index fa6cb5d85..ed3b13e23 100644 --- a/pandora/document/management/commands/sync_documentsort.py +++ b/pandora/document/management/commands/sync_documentsort.py @@ -5,7 +5,6 @@ from django.db import connection, transaction from django.db.models import fields from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch diff --git a/pandora/item/management/commands/get_frame.py b/pandora/item/management/commands/get_frame.py index 1aaba6245..fe96f9b1d 100644 --- a/pandora/item/management/commands/get_frame.py +++ b/pandora/item/management/commands/get_frame.py @@ -4,7 +4,6 @@ from django.core.management.base import BaseCommand from django.conf import settings from django.db import transaction -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models diff --git a/pandora/item/management/commands/rebuild_filter.py b/pandora/item/management/commands/rebuild_filter.py index eb52b13b5..8beaa7c97 100644 --- a/pandora/item/management/commands/rebuild_filter.py +++ b/pandora/item/management/commands/rebuild_filter.py @@ -6,7 +6,6 @@ from django.db import connection, transaction from django.db.models import fields from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models import clip.models diff --git a/pandora/item/management/commands/rebuild_find.py b/pandora/item/management/commands/rebuild_find.py index 8418fc2ff..7681682dd 100644 --- a/pandora/item/management/commands/rebuild_find.py +++ b/pandora/item/management/commands/rebuild_find.py @@ -5,7 +5,6 @@ from django.db import connection, transaction from django.db.models import fields from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models import clip.models diff --git a/pandora/item/management/commands/rebuild_indexes.py b/pandora/item/management/commands/rebuild_indexes.py index 5ad619717..fb197f4c8 100644 --- a/pandora/item/management/commands/rebuild_indexes.py +++ b/pandora/item/management/commands/rebuild_indexes.py @@ -5,7 +5,6 @@ from django.db import connection, transaction from django.db.models import fields from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models import clip.models diff --git a/pandora/item/management/commands/rebuild_sort.py b/pandora/item/management/commands/rebuild_sort.py index 5e29ade82..fbcc7d962 100644 --- a/pandora/item/management/commands/rebuild_sort.py +++ b/pandora/item/management/commands/rebuild_sort.py @@ -6,7 +6,6 @@ from django.db import connection, transaction from django.db.models import fields from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models diff --git a/pandora/item/management/commands/sqlfindindex.py b/pandora/item/management/commands/sqlfindindex.py index 81c394882..4348f6cbe 100644 --- a/pandora/item/management/commands/sqlfindindex.py +++ b/pandora/item/management/commands/sqlfindindex.py @@ -5,7 +5,6 @@ from django.core.management.base import BaseCommand from django.db import connection, transaction from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models diff --git a/pandora/item/management/commands/sync_itemsort.py b/pandora/item/management/commands/sync_itemsort.py index 4640229d7..bc34e949a 100644 --- a/pandora/item/management/commands/sync_itemsort.py +++ b/pandora/item/management/commands/sync_itemsort.py @@ -5,7 +5,6 @@ from django.db import connection, transaction from django.db.models import fields from django.conf import settings -settings.RELOAD_CONFIG = False import app.monkey_patch from ... import models import clip.models diff --git a/pandora/manage.py b/pandora/manage.py index 700a18020..4800a3661 100755 --- a/pandora/manage.py +++ b/pandora/manage.py @@ -73,5 +73,3 @@ 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_from_command_line(sys.argv) - import app.config - app.config.shutdown() diff --git a/pandora/settings.py b/pandora/settings.py index 99eda0ba7..b25960150 100644 --- a/pandora/settings.py +++ b/pandora/settings.py @@ -220,7 +220,6 @@ XACCELREDIRECT = False SITE_CONFIG = join(PROJECT_ROOT, 'config.jsonc') DEFAULT_CONFIG = join(PROJECT_ROOT, 'config.pandora.jsonc') -RELOAD_CONFIG = False #used if CONFIG['canDownloadVideo'] is set TRACKER_URL = "udp://tracker.openbittorrent.com:80" @@ -275,7 +274,6 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') DATA_UPLOAD_MAX_MEMORY_SIZE = 32 * 1024 * 1024 -RELOADER_RUNNING = False #you can ignore things below this line #========================================================================= LOCAL_APPS = []