mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 09:06:06 +00:00
refactor: Lazy load celery_app in __getattr__ to improve module attribute access and reduce initial import overhead.
This commit is contained in:
parent
b26916dc7c
commit
8b22f1c63a
1 changed files with 8 additions and 3 deletions
|
|
@ -1,6 +1,11 @@
|
|||
# dispatcharr/__init__.py
|
||||
|
||||
# For Celery:
|
||||
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