fix(supabase_client): enhance cursor method to reconnect on dropped connection
This commit is contained in:
parent
fdf54ae279
commit
c39dcc6fe8
Binary file not shown.
|
|
@ -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)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue