Bug Fix where - in exceptional cases - a connection without correct search path could be used (out of the connection pool).
This commit is contained in:
@@ -6,6 +6,7 @@ from dataclasses import dataclass
|
||||
from flask import current_app
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.orm import joinedload
|
||||
from sqlalchemy import text
|
||||
|
||||
from common.extensions import db, cache_manager
|
||||
from common.models.interaction import ChatSession, Interaction
|
||||
@@ -111,6 +112,14 @@ class ChatSessionCacheHandler(CacheHandler[CachedSession]):
|
||||
Note:
|
||||
Only adds the interaction if it has an answer
|
||||
"""
|
||||
# Log connection context right before any potential lazy load of interaction properties
|
||||
try:
|
||||
sp = db.session.execute(text("SHOW search_path")).scalar()
|
||||
cid = id(db.session.connection().connection)
|
||||
current_app.logger.info(f"DBCTX before_lazy_load conn_id={cid} search_path={sp}")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not interaction.specialist_results:
|
||||
return # Skip incomplete interactions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user