Skip to content

Commit

Permalink
add fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c committed Sep 10, 2024
1 parent 8c1a668 commit 2ae6cdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/agentscope/memory/temporary_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ def add(
else:
record_memories = memories

# FIXME: a single message may be inserted multiple times
# Assert the message types
memories_idx = set(_.id for _ in self._content if hasattr(_, "id"))
for memory_unit in record_memories:
# in case this is a PlaceholderMessage, try to update
# the values first
# TODO: Unify PlaceholderMessage and Msg into one class to avoid
# type error
if isinstance(memory_unit, AsyncResult):
memory_unit = memory_unit.result()

Expand Down
4 changes: 3 additions & 1 deletion src/agentscope/server/async_result_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ def prepare(self) -> int:
return self._get_object_id()

def set(self, key: int, value: bytes) -> None:
qkey = RedisPool.TASK_QUEUE_PREFIX + str(key)
self.pool.set(key, value, ex=self.max_timeout)
self.pool.rpush(RedisPool.TASK_QUEUE_PREFIX + str(key), key)
self.pool.rpush(qkey, key)
self.pool.expire(qkey, self.max_timeout)

def get(self, key: int) -> bytes:
result = self.pool.get(key)
Expand Down

0 comments on commit 2ae6cdb

Please sign in to comment.