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

🤖 Refactor Celery Initialization and Database Setup Checks #1591

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sentry-autofix[bot]
Copy link
Contributor

👋 Hi there! This PR was automatically generated by Autofix 🤖

This fix was triggered by Rohan Agarwal

Fixes SEER-9P

This pull request includes significant changes to how the Celery application and database initialization are handled. In src/celery_app/app.py, the Celery initialization now connects the configuration setup to the worker's startup event instead of the on_configure event. A utility function _is_celery_worker() has been added to check if the current process is a Celery worker, ensuring that the bootup() function and periodic task setup only execute in a Celery context.

In src/seer/db.py, additional functions is_db_initialized() and mark_db_initialized() are introduced for checking and marking the database initialization state in the Flask application context. The initialize_database() function now checks if the database has already been initialized before proceeding, thereby preventing redundant setups and ensuring better state management within the application.

If you have any questions or feedback for the Sentry team about this fix, please email [email protected] with the Run ID: 1990.

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 this pull request may close these issues.

0 participants