fix: login issue #2

This commit is contained in:
2026-04-17 16:04:12 +03:00
parent 2ef199e4c5
commit 4f35bef6e3
2 changed files with 10 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
# MQTT live data — Phase 5: all functions now backed by Postgres
from database.pg_mqtt import (
init_db,
close_db,
@@ -19,9 +20,14 @@ from database.pg_mqtt import (
ensure_current_partitions,
)
# SQLite connection — still used by melodies, builder, manufacturing, and crm
# modules that have not yet been cut over to Postgres.
from database.core import get_db
__all__ = [
"init_db",
"close_db",
"get_db",
"purge_loop",
"purge_old_data",
"insert_log",

View File

@@ -108,6 +108,8 @@ async def crm_poll_loop():
@app.on_event("startup")
async def startup():
init_firebase()
from database.core import init_db as sqlite_init_db
await sqlite_init_db()
await melody_service.migrate_from_firestore()
mqtt_manager.start(asyncio.get_event_loop())
asyncio.create_task(db.partition_manager_loop())
@@ -125,6 +127,8 @@ async def startup():
@app.on_event("shutdown")
async def shutdown():
mqtt_manager.stop()
from database.core import close_db as sqlite_close_db
await sqlite_close_db()
await close_nextcloud_client()