diff --git a/daemon/nopaqued.py b/daemon/nopaqued.py index 44fb96e4..c57c8bda 100644 --- a/daemon/nopaqued.py +++ b/daemon/nopaqued.py @@ -2,6 +2,7 @@ from concurrent.futures import ThreadPoolExecutor from tasks.check_corpora import check_corpora from tasks.check_jobs import check_jobs from tasks.notify import notify +import os # TODO: Check if thread is still alive and execute next thread after that @@ -9,13 +10,15 @@ from tasks.notify import notify def nopaqued(): + execute_notifications = os.environ.get('NOPAQUE_EXECUTE_NOTIFICATIONS') # executing background functions while True: with ThreadPoolExecutor(max_workers=3) as executor: executor.submit(check_jobs) executor.submit(check_corpora) - executor.submit(notify, True) # If True mails are sent. - # If False no mails are sent. + executor.submit(notify, execute_notifications) + # If execute_notifications True mails are sent. + # If execute_notifications False no mails are sent. # But notification status will be set nonetheless. diff --git a/nopaque.env.tpl b/nopaque.env.tpl index ffea48ba..25cc5587 100644 --- a/nopaque.env.tpl +++ b/nopaque.env.tpl @@ -27,6 +27,7 @@ NOPAQUE_DOMAIN= NOPAQUE_LOG_LEVEL= NOPAQUE_MAIL_SENDER= NOPAQUE_STORAGE= +NOPAQUE_EXECUTE_NOTIFICATIONS= ### PostgreSQL ### POSTGRES_DB_NAME=