Skip to content

Commit

Permalink
fix redis pool
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c committed Sep 9, 2024
1 parent b10f426 commit ae2ae9a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 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:
self.pool.set(key, value, ex=self.max_timeout)
self.pool.rpush(RedisPool.TASK_QUEUE_PREFIX + str(key), key)
pipe = self.pool.pipeline()
pipe.set(key, value, ex=self.max_timeout)
pipe.rpush(RedisPool.TASK_QUEUE_PREFIX + str(key), key)
pipe.execute()

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

0 comments on commit ae2ae9a

Please sign in to comment.