Change the APScheduler Logic and try to catch more errors in Daemon

This commit is contained in:
Patrick Jentsch
2022-07-04 14:11:10 +02:00
parent 76924956de
commit 5771e156ce
6 changed files with 56 additions and 104 deletions

View File

@ -18,6 +18,9 @@ class Config:
SESSION_COOKIE_SECURE = \
os.environ.get('SESSION_COOKIE_SECURE', 'false').lower() == 'true'
''' # Flask-APScheduler # '''
JOBS = []
''' # Flask-Assets '''
ASSETS_DEBUG = os.environ.get('ASSETS_DEBUG', 'false').lower() == 'true'
@ -112,6 +115,16 @@ class Config:
fmt=app.config['NOPAQUE_LOG_FORMAT'],
datefmt=app.config['NOPAQUE_LOG_DATE_FORMAT']
)
if app.config['NOPAQUE_IS_PRIMARY_INSTANCE']:
app.config['JOBS'].append(
{
"id": "daemon",
"func": "app.daemon:daemon",
"args": (app,),
"trigger": "interval",
"seconds": 3,
}
)
if app.config['NOPAQUE_LOG_STDERR_ENABLED']:
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(formatter)