fix(supabase_client): enhance cursor method to reconnect on dropped connection

This commit is contained in:
Ahmet Guzererler 2026-03-25 01:03:10 +01:00
parent fdf54ae279
commit c39dcc6fe8
2 changed files with 4 additions and 1 deletions

BIN
tradingagents/agents/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -94,7 +94,10 @@ class SupabaseClient:
cls._instance = None
def _cursor(self):
"""Return a RealDictCursor."""
"""Return a RealDictCursor, reconnecting if the connection was dropped."""
if self._conn.closed:
self._conn = psycopg2.connect(self._dsn)
self._conn.autocommit = True
return self._conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
# ------------------------------------------------------------------