mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 23:31:31 +02:00
Scan page froze on a duplicate each key; every tab body now sits in a svelte:boundary. Composite discovered_at indexes on the five result tables, leads counted in one FILTER pass, dashboard and scan-service first-seen counts bounded to the scans in the window, ANALYZE at finalize, shm_size on the db service, SQL_ECHO instead of DEBUG, an entrypoint that serves with workers outside reload. Settled-scope aggregates and search pages are cached by target revision; triage, dismissal, interest evaluation, notes, certificate rechecks and re-ranking bump it. Requests per page cut: single-flight GETs, one schemas endpoint, batched whois correlations, a counts endpoint for the dashboard, deduped store loads, trimmed coverage payloads. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NWRq8utu7KXsVBVU3gYNi7
28 lines
699 B
Python
28 lines
699 B
Python
"""Sync database session for Celery workers."""
|
|
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import Session, sessionmaker
|
|
|
|
from app.config import settings
|
|
|
|
engine = create_engine(
|
|
settings.database_url,
|
|
echo=settings.SQL_ECHO,
|
|
pool_pre_ping=True,
|
|
pool_size=settings.WORKER_DB_POOL_SIZE,
|
|
max_overflow=settings.WORKER_DB_MAX_OVERFLOW,
|
|
pool_timeout=settings.WORKER_DB_POOL_TIMEOUT,
|
|
pool_recycle=settings.DB_POOL_RECYCLE,
|
|
connect_args={"application_name": f"{settings.APP_NAME}-worker"},
|
|
)
|
|
|
|
SyncSessionLocal = sessionmaker(
|
|
bind=engine,
|
|
class_=Session,
|
|
expire_on_commit=False,
|
|
)
|
|
|
|
|
|
def get_sync_session() -> Session:
|
|
return SyncSessionLocal()
|