mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-06 20:15:17 +02:00
fix(notifications): break db <-> notifications.persistence circular import
When app.notifications is the import entry point (e.g. Celery loading app.notifications.service before any ORM code), app.db re-entered the half-initialized app.notifications.persistence at its model-registration import and failed with "cannot import name 'Notification' ... partially initialized". Import app.db at the top of app/notifications/__init__.py so db fully initializes (including its own Notification registration) before we re-import from .persistence. Pre-existing issue (reproduces on the base commit); surfaced by the celery worker startup.
This commit is contained in:
parent
88fe213176
commit
620c378254
1 changed files with 4 additions and 0 deletions
|
|
@ -6,6 +6,10 @@ the router in :mod:`app.notifications.api` exposes the inbox endpoints.
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
# Initialize app.db first to avoid a partial-init circular import when this
|
||||||
|
# package is the entry point (e.g. Celery loading it before any ORM code).
|
||||||
|
import app.db # noqa: F401
|
||||||
|
|
||||||
from app.notifications.persistence import Notification
|
from app.notifications.persistence import Notification
|
||||||
from app.notifications.service import NotificationService
|
from app.notifications.service import NotificationService
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue