From 54da68cfe71d7def27f15519182dc716d0fd0bc0 Mon Sep 17 00:00:00 2001 From: vbarda Date: Wed, 7 Aug 2024 12:25:34 -0400 Subject: [PATCH] remove flag --- .../langgraph/checkpoint/postgres/__init__.py | 7 ------- .../langgraph/checkpoint/postgres/aio.py | 7 ------- 2 files changed, 14 deletions(-) diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py index 5649e4e8c..6b7c465fd 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py @@ -24,8 +24,6 @@ from langgraph.checkpoint.serde.base import SerializerProtocol class PostgresSaver(BasePostgresSaver): lock: threading.Lock - is_setup: bool - def __init__( self, conn: Connection, @@ -36,7 +34,6 @@ class PostgresSaver(BasePostgresSaver): self.conn = conn self.pipe = pipe self.lock = threading.Lock() - self.is_setup = False @classmethod @contextmanager @@ -68,8 +65,6 @@ class PostgresSaver(BasePostgresSaver): already exist. It is called automatically when needed and should not be called directly by the user. """ - if self.is_setup: - return with self.lock: with self.conn.cursor(binary=True) as cur: try: @@ -87,8 +82,6 @@ class PostgresSaver(BasePostgresSaver): if self.pipe: self.pipe.sync() - self.is_setup = True - def list( self, config: Optional[RunnableConfig], diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py index 7b2895b1c..0fc86ec3b 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py @@ -22,8 +22,6 @@ from langgraph.checkpoint.serde.base import SerializerProtocol class AsyncPostgresSaver(BasePostgresSaver): lock: asyncio.Lock - is_setup: bool - def __init__( self, conn: AsyncConnection, @@ -34,7 +32,6 @@ class AsyncPostgresSaver(BasePostgresSaver): self.conn = conn self.pipe = pipe self.lock = asyncio.Lock() - self.is_setup = False @classmethod @asynccontextmanager @@ -66,8 +63,6 @@ class AsyncPostgresSaver(BasePostgresSaver): already exist. It is called automatically when needed and should not be called directly by the user. """ - if self.is_setup: - return async with self.lock: async with self.conn.cursor(binary=True) as cur: try: @@ -89,8 +84,6 @@ class AsyncPostgresSaver(BasePostgresSaver): if self.pipe: await self.pipe.sync() - self.is_setup = True - async def alist( self, config: Optional[RunnableConfig],