Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions libs/checkpoint-postgres/langgraph/store/postgres/aio.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -550,6 +550,11 @@
Will be applied regardless of whether the PostgresStore instance was initialized with a pipeline.
If pipeline mode is not supported, will fall back to using transaction context manager.
"""
is_pooled_conn = isinstance(self.conn, AsyncConnectionPool)
# With AsyncConnectionPool, each _cursor() call checks out its own connection.
# The pool does not hand out the same connection concurrently, so a shared lock
# across calls is unnecessary here.
lock = asyncio.Lock() if is_pooled_conn else self.lock
async with _ainternal.get_connection(self.conn) as conn:
if self.pipe:
# a connection in pipeline mode can be used concurrently
Expand All @@ -566,21 +571,21 @@
# thread/coroutine at a time, so we acquire a lock
if self.supports_pipeline:
async with (
self.lock,
lock,
conn.pipeline(),
conn.cursor(binary=True, row_factory=dict_row) as cur,
):
yield cur
else:
async with (
self.lock,
lock,
conn.transaction(),
conn.cursor(binary=True, row_factory=dict_row) as cur,
):
yield cur
else:
async with (
self.lock,
lock,
conn.cursor(binary=True, row_factory=dict_row) as cur,
):
yield cur
2 changes: 1 addition & 1 deletion libs/checkpoint-postgres/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "langgraph-checkpoint-postgres"
version = "3.0.3"
version = "3.0.4"
description = "Library with a Postgres implementation of LangGraph checkpoint saver."
authors = []
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion libs/checkpoint-postgres/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/langgraph/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/prebuilt/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.