From e0de964fdafa87acf1e26f10794464cecfda1842 Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Sat, 19 Jan 2019 02:27:22 -0500 Subject: [PATCH] Refactor process configuration --- core/__init__.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/__init__.py b/core/__init__.py index e5635589..d442bdbd 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -263,6 +263,15 @@ def configure_logging(): print('No log folder, logging to screen only') +def configure_process(): + global MYAPP + + MYAPP = RunningProcess() + while MYAPP.alreadyrunning(): + print('Waiting for existing session to end') + time.sleep(30) + + def initialize(section=None): global NZBGET_POSTPROCESS_ERROR, NZBGET_POSTPROCESS_NONE, NZBGET_POSTPROCESS_PAR_CHECK, NZBGET_POSTPROCESS_SUCCESS, \ NZBTOMEDIA_TIMEOUT, FORKS, FORK_DEFAULT, FORK_FAILED_TORRENT, FORK_FAILED, NOEXTRACTFAILED, SHOWEXTRACT, \ @@ -287,11 +296,7 @@ def initialize(section=None): return False configure_logging() - - MYAPP = RunningProcess() - while MYAPP.alreadyrunning(): - print('Waiting for existing session to end') - time.sleep(30) + configure_process() try: locale.setlocale(locale.LC_ALL, '')