mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-21 23:22:27 +02:00
Merge pull request #1258 from langchain-ai/nc/7aug/postgres-dont-sync-too-much
postgres: Avoid syncing pipeline unless actually needed
This commit is contained in:
@@ -239,7 +239,8 @@ class PostgresSaver(BasePostgresSaver):
|
||||
with self.conn.cursor(binary=True) as cur:
|
||||
yield cur
|
||||
finally:
|
||||
self.pipe.sync()
|
||||
if pipeline:
|
||||
self.pipe.sync()
|
||||
elif pipeline:
|
||||
# a connection not in pipeline mode can only be used by one
|
||||
# thread/coroutine at a time, so we acquire a lock
|
||||
|
||||
@@ -247,7 +247,8 @@ class AsyncPostgresSaver(BasePostgresSaver):
|
||||
async with self.conn.cursor(binary=True) as cur:
|
||||
yield cur
|
||||
finally:
|
||||
await self.pipe.sync()
|
||||
if pipeline:
|
||||
await self.pipe.sync()
|
||||
elif pipeline:
|
||||
# a connection not in pipeline mode can only be used by one
|
||||
# thread/coroutine at a time, so we acquire a lock
|
||||
|
||||
Reference in New Issue
Block a user