From 7a91363db1d7be5036ed97be079daa2536fc0993 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 15 Feb 2022 11:06:11 -0500 Subject: [PATCH] By default the system will start up the scheduled tasks, which is usually what you want, but in development it can be kind of irritating for this stuff to be spinning up when you are trying to debug something, so just set PROCESS_WAITING_TASKS to false in instance/config.py and voila!! --- config/default.py | 5 ++++- crc/__init__.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config/default.py b/config/default.py index a916a6c6..fa1a1a14 100644 --- a/config/default.py +++ b/config/default.py @@ -97,4 +97,7 @@ MAIL_USERNAME = environ.get('MAIL_USERNAME', default='') MAIL_PASSWORD = environ.get('MAIL_PASSWORD', default='') # Local file path -SYNC_FILE_ROOT = environ.get('SYNC_FILE_ROOT', default='tests/data/IMPORT_TEST') \ No newline at end of file +SYNC_FILE_ROOT = environ.get('SYNC_FILE_ROOT', default='tests/data/IMPORT_TEST') + +# Turn on/off processing waiting tasks +PROCESS_WAITING_TASKS = environ.get('PROCESS_WAITING_TASKS', default='true') diff --git a/crc/__init__.py b/crc/__init__.py index c4b5075c..fd6b260d 100644 --- a/crc/__init__.py +++ b/crc/__init__.py @@ -65,9 +65,9 @@ def process_waiting_tasks(): @app.before_first_request def init_scheduler(): - scheduler.add_job(process_waiting_tasks, 'interval', minutes=1) - # scheduler.add_job(FileService.cleanup_file_data, 'interval', minutes=1440) # once a day - scheduler.start() + if app.config['PROCESS_WAITING_TASKS']: + scheduler.add_job(process_waiting_tasks, 'interval', minutes=1) + scheduler.start() # Convert list of allowed origins to list of regexes