Optimize signal read paths and enforce score invariants
Deploy / lint (push) Successful in 7s
Deploy / test (push) Successful in 1m11s
Deploy / deploy (push) Successful in 37s

This commit is contained in:
2026-07-11 13:36:59 +02:00
parent fdc49d0e28
commit 25364f8e99
12 changed files with 357 additions and 35 deletions
+10
View File
@@ -1,5 +1,8 @@
from collections.abc import AsyncGenerator
from typing import Any
from sqlalchemy.dialects.postgresql import insert as postgresql_insert
from sqlalchemy.dialects.sqlite import insert as sqlite_insert
from sqlalchemy.ext.asyncio import (
AsyncSession,
async_sessionmaker,
@@ -28,6 +31,13 @@ class Base(DeclarativeBase):
pass
def insert_for_session(session: AsyncSession, table: Any) -> Any:
"""Build a dialect-native INSERT that supports conflict handling."""
if session.get_bind().dialect.name == "postgresql":
return postgresql_insert(table)
return sqlite_insert(table)
async def get_session() -> AsyncGenerator[AsyncSession, None]:
async with async_session_factory() as session:
yield session