Skip to content

Commit ba6a627

Browse files
fix(memory): fix the bug in redis memory that use bytes data as the message key (#1146)
--------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 40a1089 commit ba6a627

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/agentscope/memory/_working_memory/_redis_memory.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def __init__(
8888
db=db,
8989
password=password,
9090
connection_pool=connection_pool,
91+
decode_responses=True,
9192
**kwargs,
9293
)
9394

@@ -559,9 +560,17 @@ async def update_messages_mark(
559560
await pipe.execute()
560561
return updated_count
561562

562-
async def close(self) -> None:
563-
"""Close the Redis client connection."""
564-
await self._client.close()
563+
async def close(self, close_connection_pool: bool | None = None) -> None:
564+
"""Close the Redis client connection.
565+
566+
Args:
567+
close_connection_pool (`bool | None`, optional):
568+
Decides whether to close the connection pool used by this
569+
Redis client, overriding Redis.auto_close_connection_pool.
570+
By default, let Redis.auto_close_connection_pool decide
571+
whether to close the connection pool
572+
"""
573+
await self._client.aclose(close_connection_pool=close_connection_pool)
565574

566575
async def __aenter__(self) -> "RedisMemory":
567576
"""Enter the async context manager.

0 commit comments

Comments
 (0)