mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-17 16:50:53 +00:00
refactor: Eagerly import celery_app to ensure proper configuration in production
Updated the import mechanism for celery_app to avoid issues with lazy-loading, ensuring the default Celery app is correctly configured in production environments. Removed the __getattr__ function for celery_app, simplifying the module structure.
This commit is contained in:
parent
44cf9c4b90
commit
d93cb6265f
1 changed files with 6 additions and 8 deletions
|
|
@ -1,11 +1,9 @@
|
|||
# dispatcharr/__init__.py
|
||||
|
||||
# For Celery: import eagerly so @shared_task binds to the configured app.
|
||||
# Lazy-loading via __getattr__ left the default Celery app unconfigured in
|
||||
# production (no CELERY_BROKER_URL in env), so .delay() fell back to AMQP
|
||||
# localhost and failed with ConnectionRefusedError.
|
||||
from .celery import app as celery_app
|
||||
|
||||
__all__ = ("celery_app",)
|
||||
|
||||
|
||||
def __getattr__(name: str):
|
||||
if name == "celery_app":
|
||||
from .celery import app as celery_app
|
||||
|
||||
return celery_app
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue