Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask background task scheduler doesn't run if werkzeug is not the WSGI server #1566

Closed
jagraff opened this issue Mar 21, 2024 · 0 comments · Fixed by #1565
Closed

Flask background task scheduler doesn't run if werkzeug is not the WSGI server #1566

jagraff opened this issue Mar 21, 2024 · 0 comments · Fixed by #1565

Comments

@jagraff
Copy link
Contributor

jagraff commented Mar 21, 2024

In order to prevent the apscheduler from executing twice in debug mode, hasher-matcher-actioner checks whether WERKZEUG_RUN_MAIN=="true" before starting the scheduler, because in debug mode the Flask service will initialize twice - werkzeug will set that environment variable only for the "outer" process, meaning that if werkzeug is the WSGI server this is a reliable way to only run the scheduler once in debug mode. However, the "production" version of HMA uses gunicorn as the WSGI server. Since gunicorn doesn't set that enviornment variable, the production version of HMA will incorrectly not trigger the scheduler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant